04.10.2010, 18:09
Como Funciona As Chaves? ( { } )
As Chaves funcionao assim:
Exemplo de um public:
Um Comando
Os cуdigos sitados eu usei '['code] ['/code] Para Distacar.
As Chaves funcionao assim:
Exemplo de um public:
Код:
public OnPlayerText(playerid,text[]) {// ABRE return 1; }// FECHA
Код:
if(strcmp(cmdtext,"/check", true) == 0) {// ABRE if(IsPlayerConnected(playerid)) {// ABRE if(IsPlayerInAdmin(playerid)) {// ABRE }//FECHA }//FECHA return 1; }//FECHA
pawn Код:
//---------------------------<[ OnPlayerCommandText ]>--------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playerdinheiro;
new giveplayer[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new vehicleid = GetPlayerVehicleID(playerid);
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
/* CREEEEEEEEEEEEEEEEEEEEEUUUUUUUUUUUUUUUUUU */
if(strcmp(cmd, "/creu", true) == 0 || strcmp(cmd, "/crйu", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб danзando o Crйu.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
ApplyAnimation(playerid,"CHOPPA","CHOPPA_back",4.1,1,1,1,1,1);
SendClientMessage(playerid, COLOR_DBLUE, "ЙЙЙЙ Creeeeeeu!");
return 1;
}
if(strcmp(cmd, "/cvip", true) == 0 || strcmp(cmd, "/chatvip", true) == 0)
{
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pVIP] >= 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /cvip [Chat Vip]");
return 1;
}
format(string, sizeof(string), "** VIP %s: %s", sendername, result);
SendVIPMessage(0xFFCCFFAA,string);
printf("VIP %s: %s", sendername, result);
}
return 1;
}
if (strcmp(cmd, "/infodacasa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] != 0)
{
InfoDaCasa();
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s olha as info da casa.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Voce nao esta logado !");
}
}
return 1;
}
if(!strcmp(cmdtext, "/cinto", true))
{
if(CintoPlayer[playerid]==1) return SendClientMessage(playerid,0x00FF00AA,"Vocк ja esta de Cinto");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0x00FF00AA,"Vocк nгo esta em um Carro");
CintoPlayer[playerid] = 1;
SendClientMessage(playerid,VERDE,"[AVISO]: Parabйns Vocк esta de Cinto, Agora Esta Protegido (/tirarcinto)");
SetPlayerWantedLevel(playerid, 0);
return 1;
}
if(!strcmp(cmdtext, "/tirarcinto", true))
{
if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"Vocк nгo esta em um Carro");
if(CintoPlayer[playerid]==0) return SendClientMessage(playerid,0x00FF00AA,"Vocк nгo esta de Cinto");
CintoPlayer[playerid] = 0;
SendClientMessage(playerid,AMARELO,"[AVISO]: Cuidado Vocк Esta Sem Cinto, Pode Morrer (/cinto)");
SetPlayerWantedLevel(playerid, 0);
}
return 1;
}
if(strcmp(cmdtext, "/ligarv", true) == 0)
{
if(Engine[vehicleid] == 0)
{
SendClientMessage(playerid, VERDE, "Ligando veiculo...");
SetTimerEx("EngineTimer", 2000, 0, "i", playerid);
}
else if(Engine[vehicleid] == 1)
{
SendClientMessage(playerid, AMARELO, "Seu veiculo ja estб ligado!.");
}
return 1;
}
if(strcmp(cmdtext, "/desligarv", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, VERMELHO, "Saia do veiculo digitando /sairv.");
Engine[vehicleid] = 0;
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid, VERMELHO, "Vocк nгo estб em um veiculo.");
}
}
return 1;
}
if(strcmp(cmd, "/sairv", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
return 1;
}
if(strcmp(cmdtext, "/freio", true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 1)
{
if(Freio[vehicleid] == 0)
{
SendClientMessage(playerid, VERMELHO, "Quando quizer por o freio de mгo, use /freio novamente");
Freio[vehicleid] = 1;
TogglePlayerControllable(playerid,1);
}
else if(Freio[vehicleid] == 1)
{
SendClientMessage(playerid, VERMELHO, "Saia do veiculo apertando (Enter), (F) ou digitando /sair.");
SendClientMessage(playerid, VERDE, "Quando quizer tirar o freio de mгo, use /freio novamente");
Freio[vehicleid] = 0;
TogglePlayerControllable(playerid,0);
}
}
else
{
SendClientMessage(playerid, VERMELHO, "Ligue o veiculo antes de mexer no freio de mгo!.");
}
return 1;
}
return 0;
}