Problema mettere comando in gm

CrazyRetroHabbo

Utente Medio
Autore del topic
9 Aprile 2011
144
0
Miglior risposta
0
Salve ragazzi
ho bisogno di mettere il comando per entrare negli edifici con il tasto invio in questo codice
PHP:
Perfavore, Entra oppure Registrati per vedere i codici!
grazie in anticipo
 
Riferimento: mettere comando in gm

Mettilo sotto onplayercommandtext se vuoi che il player lo faccia scrivendo enter

Altrimenti modifichi un po' e lo metti sotto onplayerkeystatechange , così che possa entrare con un tasto..
 
Riferimento: mettere comando in gm

@CrazyRetroHabbo

OnPlayerCommandText(...)
{
if(strcmp(cmd, "enter", true) == 0)
{
for(new i = 0; i < sizeof(Houses); i++)
{
if (PlayerToPoint(1.0, playerid,Houses[EnterX], Houses[EnterY], Houses[EnterZ]))
{
//if(GetPlayerVirtualWorld(playerid) == Houses[EnterWorld])
//{
if(PlayerInfo[playerid][pHouseKey] == i || Houses[Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
{
PlayerActionMessage(playerid,15.0,"apre la porta ed entra.");
SetPlayerInterior(playerid,Houses[ExitInterior]);
SetPlayerPos(playerid,Houses[ExitX],Houses[ExitY],Houses[ExitZ]);
SetPlayerVirtualWorld(playerid,i);
SetPlayerFacingAngle(playerid,Houses[ExitAngle]);
}
else
{
GameTextForPlayer(playerid, "~r~Chiuso", 5000, 1);
}
//}
}
}
for(new i = 0; i < sizeof(Building); i++)
{
if (PlayerToPoint(1.0, playerid,Building[EnterX], Building[EnterY], Building[EnterZ]))
{
if(GetPlayerVirtualWorld(playerid) == Building[EnterWorld])
{
if(Building[Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
{
if(GetPlayerCash(playerid) >= Building[EntranceFee])
{
PlayerActionMessage(playerid,15.0,"apre la porta ed entra.");
SetPlayerInterior(playerid,Building[ExitInterior]);
SetPlayerVirtualWorld(playerid,i);
SetPlayerPos(playerid,Building[ExitX],Building[ExitY],Building[ExitZ]);
SetPlayerFacingAngle(playerid,Building[ExitAngle]);
GivePlayerCash(playerid,-Building[EntranceFee]);
}
else
{
PlayerActionMessage(playerid,15.0,"apre la porta ed entra.");
SetPlayerInterior(playerid,Building[ExitInterior]);
SetPlayerVirtualWorld(playerid,i);
SetPlayerPos(playerid,Building[ExitX],Building[ExitY],Building[ExitZ]);
SetPlayerFacingAngle(playerid,Building[ExitAngle]);
}
}
else
{
GameTextForPlayer(playerid, "~r~Chiuso", 5000, 1);
}
}
}
}
for(new i = 0; i < sizeof(Businesses); i++)
{
if (PlayerToPoint(1.0, playerid,Businesses[EnterX], Businesses[EnterY], Businesses[EnterZ]))
{
if(GetPlayerVirtualWorld(playerid) == Businesses[EnterWorld])
{
if(PlayerInfo[playerid][pBizKey] == i || GetPlayerCash(playerid) >= Businesses[EntranceCost])
{
if(PlayerInfo[playerid][pBizKey] != i)
{
if(Businesses[Locked] == 1 && PlayerInfo[playerid][pAdmin] == 0)
{
GameTextForPlayer(playerid, "~r~Business Chiuso.", 5000, 1);
return 1;
}
if(Businesses[Products] == 0)
{
GameTextForPlayer(playerid, "~r~Non ci sono prodotti.", 5000, 1);
return 1;
}
new businesstype[126];
if(Businesses[BizType] == 1) { businesstype = "[INFO] Comandi disponibili: /mangia"; }
else if(Businesses[BizType] == 2) { businesstype = "[INFO] Comandi disponibili: /compracellulare"; }
else if(Businesses[BizType] == 3) { businesstype = "[INFO] Comandi disponibili: /compra"; }
else if(Businesses[BizType] == 4) { businesstype = "[INFO] Comandi disponibili: /compraarma"; }
else if(Businesses[BizType] == 5) { businesstype = "[INFO] Comandi disponibili: /pub"; }
else if(Businesses[BizType] == 6) { businesstype = "[INFO] Comandi disponibili: /vestiti"; }
else if(Businesses[BizType] == 7) { businesstype = "[INFO] Comandi disponibili: /bere"; }
else if(Businesses[BizType] == 12) { businesstype = "[INFO] Comandi disponibili: /comprapc - /installamsn - /installaantivirus"; }
else if(Businesses[BizType] == 13) { businesstype = "[INFO] Comandi disponibili: /assicura"; }
PlayerActionMessage(playerid,15.0,"apre la porta ed entra.");
GivePlayerCash(playerid,-Businesses[EntranceCost]);
format(string, sizeof(string), "[INFO:] Hai pagato $%d per entrare in %s.", Businesses[EntranceCost],Businesses[BusinessName]);
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,string);
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,businesstype);
Businesses[Till] += Businesses[EntranceCost];
Businesses[Products]--;
SetPlayerInterior(playerid,Businesses[ExitInterior]);
SetPlayerPos(playerid,Businesses[ExitX],Businesses[ExitY],Businesses[ExitZ]);
SetPlayerVirtualWorld(playerid,i);
SetPlayerFacingAngle(playerid,Businesses[ExitAngle]);
if(Businesses[BizType] == 8)
{
PlayerActionMessage(playerid,15.0,"apre la porta ed entra.");
SoftAirPlayers ++;
SetPlayerVirtualWorld(playerid,0);
PlayerSoftAiring[playerid] = 1;
SetPlayerInterior(playerid,10);
new rand = random(sizeof(SoftAirSpawns));
SetPlayerPos(playerid, SoftAirSpawns[rand][0], SoftAirSpawns[rand][1], SoftAirSpawns[rand][2]);
TogglePlayerControllable(playerid, 0);
}
if(Businesses[BizType] == 9)
{
PlayerKarting[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Puoi adesso partecipare alla Kart Race. Prendi un Kart");
SetPlayerInterior(playerid,Businesses[EnterInterior]);
SetPlayerVirtualWorld(playerid,Businesses[EnterWorld]);
SetPlayerPos(playerid,Businesses[EnterX],Businesses[EnterY],Businesses[EnterZ]);
SetPlayerFacingAngle(playerid,Businesses[EnterAngle]);
}
SaveBusinesses();
}
else
{
new businesstype[126];
if(Businesses[BizType] == 1) { businesstype = "[INFO] Comandi disponibili: /mangia"; }
else if(Businesses[BizType] == 2) { businesstype = "[INFO] Comandi disponibili: /compracellulare"; }
else if(Businesses[BizType] == 3) { businesstype = "[INFO] Comandi disponibili: /compra"; }
else if(Businesses[BizType] == 4) { businesstype = "[INFO] Comandi disponibili: /compraarma"; }
else if(Businesses[BizType] == 5) { businesstype = "[INFO] Comandi disponibili: /pub"; }
else if(Businesses[BizType] == 6) { businesstype = "[INFO] Comandi disponibili: /vestiti"; }
else if(Businesses[BizType] == 7) { businesstype = "[INFO] Comandi disponibili: /bere"; }
else if(Businesses[BizType] == 12) { businesstype = "[INFO] Comandi disponibili: /comprapc - /installamsn - /installaantivirus"; }
PlayerActionMessage(playerid,15.0,"apre la porta ed entra.");
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[INFO:] Entrata Free per il proprietario.");
SendClientMessage(playerid,COLOR_LIGHTYELLOW2, businesstype);
SetPlayerInterior(playerid,Businesses[ExitInterior]);
SetPlayerPos(playerid,Businesses[ExitX],Businesses[ExitY],Businesses[ExitZ]);
SetPlayerVirtualWorld(playerid,i);
SetPlayerFacingAngle(playerid,Businesses[ExitAngle]);
if(Businesses[BizType] == 8)
{
SoftAirPlayers ++;
SetPlayerVirtualWorld(playerid,0);
PlayerSoftAiring[playerid] = 1;
SetPlayerInterior(playerid,10);
new rand = random(sizeof(SoftAirSpawns));
SetPlayerPos(playerid, SoftAirSpawns[rand][0], SoftAirSpawns[rand][1], SoftAirSpawns[rand][2]);
TogglePlayerControllable(playerid, 0);
}
if(Businesses[BizType] == 9)
{
PlayerKarting[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Puoi adesso partecipare alla Kart Race. Prendi un Kart");
SetPlayerInterior(playerid,Businesses[EnterInterior]);
SetPlayerVirtualWorld(playerid,Businesses[EnterWorld]);
SetPlayerPos(playerid,Businesses[EnterX],Businesses[EnterY],Businesses[EnterZ]);
SetPlayerFacingAngle(playerid,Businesses[EnterAngle]);
}
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERRORE:] Non hai abbastanza soldi per entrare!");
}
}
}
}
return 1;
}
if(strcmp(cmd, "/uscire", true) == 0)
{
for(new i = 0; i < sizeof(Houses); i++)
{
if (PlayerToPoint(3.0, playerid,Houses[ExitX], Houses[ExitY], Houses[ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
if(PlayerInfo[playerid][pHouseKey] == i || Houses[Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
{
PlayerActionMessage(playerid,15.0,"apre la porta ed esce.");
SetPlayerInterior(playerid,Houses[EnterInterior]);
SetPlayerPos(playerid,Houses[EnterX],Houses[EnterY],Houses[EnterZ]);
SetPlayerVirtualWorld(playerid,0);
SetPlayerFacingAngle(playerid,Houses[EnterAngle]);
}
else
{
GameTextForPlayer(playerid, "~r~Porta chiusa.", 5000, 1);
}
}
}
}
for(new i = 0; i < sizeof(Building); i++)
{
if (PlayerToPoint(3, playerid,Building[ExitX], Building[ExitY], Building[ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
if(Building[Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
{
PlayerActionMessage(playerid,15.0,"apre la porta ed esce.");
SetPlayerInterior(playerid,Building[EnterInterior]);
SetPlayerVirtualWorld(playerid,Building[EnterWorld]);
SetPlayerPos(playerid,Building[EnterX],Building[EnterY],Building[EnterZ]);
SetPlayerFacingAngle(playerid,Building[EnterAngle]);
}
else
{
GameTextForPlayer(playerid, "~r~Porta chiusa.", 5000, 1);
}
}
}
}
for(new i = 0; i < sizeof(Businesses); i++)
{
if (PlayerToPoint(3, playerid,Businesses[ExitX], Businesses[ExitY], Businesses[ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
if(Businesses[Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
{
PlayerActionMessage(playerid,15.0,"apre la porta ed esce.");
SetPlayerInterior(playerid,Businesses[EnterInterior]);
SetPlayerVirtualWorld(playerid,Businesses[EnterWorld]);
SetPlayerPos(playerid,Businesses[EnterX],Businesses[EnterY],Businesses[EnterZ]);
SetPlayerFacingAngle(playerid,Businesses[EnterAngle]);
}
else
{
GameTextForPlayer(playerid, "~r~Porta chiusa.", 5000, 1);
}
}
}
}
return 1;
}
if(strcmp(cmd, "/ora", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new mtext[20];
new year, month,day;
getdate(year, month, day);
if(month == 1) { mtext = "Gennaio"; }
else if(month == 2) { mtext = "Febbraio"; }
else if(month == 3) { mtext = "Marzo"; }
else if(month == 4) { mtext = "Aprile"; }
else if(month == 5) { mtext = "Maggio"; }
else if(month == 6) { mtext = "Giugno"; }
else if(month == 7) { mtext = "Luglio"; }
else if(month == 8) { mtext = "Agosto"; }
else if(month == 9) { mtext = "Settembre"; }
else if(month == 10) { mtext = "Ottobre"; }
else if(month == 11) { mtext = "Novembre"; }
else if(month == 12) { mtext = "Dicembre"; }
new hour,minuite,second;
gettime(hour,minuite,second);
FixHour(hour);
hour = shifthour;

format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d:%d~g~|", day, mtext, hour, minuite,second);
GameTextForPlayer(playerid, string, 5000, 1);
}
return 1;
}
}
 
Riferimento: mettere comando in gm

Guarda è tutto semplice, ti basta andare nel OnPlayerKeyStateChange e fare cosi.
Adesso ti spiego il Codice.
KEY_SECONDARY_ATTACK = INVIO
In mezzo alle parentesi Graffe inserisce il Comando /entrare senza la Stringa
Codice:
Perfavore, Entra oppure Registrati per vedere i codici!
Ecco, questo è il Codice Completo ti basta inserirlo nel OnPlayerKeyStateChange se vuoi Saperne di più visita
Perfavore, Entra oppure Registrati per vedere i Link!


Codice:
Perfavore, Entra oppure Registrati per vedere i codici!
Questo è il Codice COMPLETO
Codice:
Perfavore, Entra oppure Registrati per vedere i codici!
 
Ultima modifica: