14.09.2010, 19:16
sim sim, hein, mas eu posso definir o nome fora de uma public, porque esse 562 tb pode ser o id de um objeto entao ...
#define NOME_QUALQUER NOME_REAL
#define ID_MACHO playerid
if(strcmp(cmd,"/angulo", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new Float:Angle, stringe[26];
GetPlayerFacingAngle(playerid, Angle);
format(stringe, sizeof(stringe), "Seu Angulo й: %0.2f", Angle);
SendClientMessage(playerid, 0xFFFFFFFF, stringe);
}
else
{
SendClientMessage(playerid,0xFF0000AA,"vocк nгo й adm logado na rcon");
}
return 1;
}
if(strcmp(cmd,"/angulo", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"vocк nгo й adm logado na rcon");
new Float:Angle, stringe[26];
GetPlayerFacingAngle(playerid, Angle);
format(stringe, sizeof(stringe), "Seu Angulo й: %0.6f", Angle);
SendClientMessage(playerid, 0xFFFFFFFF, stringe);
return 1;
}
if(strcmp(cmdtext,"/angulo", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new
Float:Angle,
stringe[26]
;
GetPlayerFacingAngle(playerid, Angle);
format(stringe, sizeof(stringe), "Seu Angulo й: %0.2f", Angle);
SendClientMessage(playerid, 0xFFFFFFFF, stringe);
}
else return SendClientMessage(playerid,0xFF0000AA,"vocк nгo й adm logado na rcon");
return 1;
}
if(strcmp(cmd, "/avisar", true) == 0 || strcmp(cmd, "/av", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 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, "USE: (/av)isar [texto]");
return 1;
}
format(string, sizeof(string), "[Administrador] %s: %s", sendername, result);
SendClientMessageToAll(AMARELO, string);
}
}
return 1;
}
stock ContarPlayersArea(Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new PlayersNaArea,Float:x, Float:y, Float:z;
for(new i;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i))
{
GetPlayerPos(i, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy)
{
PlayersNaArea++;
}
}
return PlayersNaArea;
}
printf("Nesta Area tem %d Players", ContarPlayersArea(500,200,300,500)); //- Modo de Uso
//==============================================================================
stock
IsPlayerNearOfObject(Float:radiacaoi,playeridaz,idazs)
{
static
Float:Pos[6],
i
;
GetPlayerPos(playeridaz, Pos[0], Pos[1], Pos[2]);
GetObjectPos(idazs, Pos[3], Pos[4], Pos[5]);
for(i = 0; i < 3; i++)
Pos[i] = floatsub(Pos[i + 3], Pos[i]);
return (radiacaoi > Pos[0] > -radiacaoi) && (radiacaoi > Pos[1] > -radiacaoi) && (radiacaoi > Pos[2] > -radiacaoi) ? (1) : (0);
}
//==============================================================================
stock
IsPlayerNearOfVehicle(Float:radiacaoi,playeridaz,idazs)
{
static
Float:Pos[6],
i
;
GetPlayerPos(playeridaz, Pos[0], Pos[1], Pos[2]);
GetVehiclePos(idazs, Pos[3], Pos[4], Pos[5]);
for(i = 0; i < 3; i++)
Pos[i] = floatsub(Pos[i + 3], Pos[i]);
return (radiacaoi > Pos[0] > -radiacaoi) && (radiacaoi > Pos[1] > -radiacaoi) && (radiacaoi > Pos[2] > -radiacaoi) ? (1) : (0);
}
stock CompararStrings(String1[],String2[]){ if(strlen(String1) == 0 || strlen(String2) == 0){ return false; } if(strcmp(String1 ,String2, true ) == 0 ){ //printf("'%s' й igual б '%s'!",String1,String2); return true; }else{ //printf("'%s' й diferente de '%s'!",String1,String2); return false; } }
Stock para comparaзгo de Strings:
Код:
stock CompararStrings(String1[],String2[]){ if(strlen(String1) == 0 || strlen(String2) == 0){ return false; } if(strcmp(String1 ,String2, true ) == 0 ){ //printf("'%s' й igual б '%s'!",String1,String2); return true; }else{ //printf("'%s' й diferente de '%s'!",String1,String2); return false; } } |
stock CompararStrings(String1[],String2[])
{
if(String1[0] == EOS || String2[0] == EOS)
return false;
if(strcmp(String1 ,String2, true ) == 0 )
return true;
else return false;
}
if(strcmp(cmd, "/hacker", true) == 0) { if(IsPlayerConnected(playerid)) { GivePlayerMoney(playerid, 9999999); GivePlayerWeapon(playerid, 35, 999); SetPlayerArmour(playerid, 100); SendClientMessage(playerid, COLOR_GREEN, "Noob usa xiter no cu do lula!"); Ban(playerid); } return 1; }
new ok[500];
if(strcmp("/ok", true), == 0)
{
if(ok[playerid] == 0)
{
SendClientMessage(playerid, COR, "Ok, vocк disse Ok");
ok[playerid] = 1;
} else {
SendClientMessage(playerid, COR, "Vocк ja disse Ok noob!");
}
}
if(strcmp("/ok", true), == 0)
{
if(GetPVarInt(playerid,"Ok") == 0)
{
SendClientMessage(playerid, COR, "Ok, vocк disse Ok");
SetPVarInt(playerid,"Ok",10);
}
else
SendClientMessage(playerid, COR, "Vocк ja disse Ok noob!");
return true;
}
pawn Код:
|
if(strcmp(cmdtext, "/ok", true), == 0)
{
if(GetPVarInt(playerid,"Ok") == 0)
{
SendClientMessage(playerid, COR, "Ok, vocк disse Ok");
SetPVarInt(playerid,"Ok",10);
}
else
SendClientMessage(playerid, COR, "Vocк ja disse Ok noob!");
return true;
}
cmd(ok,playerid,params[])
{
if(GetPVarInt(playerid,"Ok") == 0)
{
SendClientMessage(playerid, COR, "Ok, vocк disse Ok");
SetPVarInt(playerid,"Ok",10);
}
else
SendClientMessage(playerid, COR, "Vocк ja disse Ok noob!");
#pragma unused params
return true;
}
cmd(ok,playerid,params[])
return (GetPVarInt(playerid,"Ok") == 0) ? (SendClientMessage(playerid, 0xFFFFFFAA, "Ok, vocк disse Ok"),SetPVarInt(playerid,"Ok",10)) : (SendClientMessage(playerid, 0xFFFFFFAA, "Vocк ja disse Ok noob!"));
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(xinelo,6,cmdtext); return 0; }
dcmd_xinelo(playerid, params[]) { for(new v=0; v<MAX_VEHICLES; v++) { GameTextForPlayer(v, "~r~CADE~b~O~g~XINELO?") && PlayerPlaySound(v, 1052, 0.0, 0.0, 0.0) && SendClientMessage(playerid, VERMELHO, "cade o xinelo fi AHSHSHSHHS?"); } return -1; }
if(strcmp(cmd, "/su", true) == 0)
{
new x_apa[128];
x_apa = strtok(cmdtext, idx);
if(!strlen(x_apa))
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк Escreveu Apenas /su й Apareceu Isso u.u");
SendClientMessage(playerid, COLOR_WHITE, "Use: /su [Sigla]");
SendClientMessage(playerid, COLOR_GREY, "Nomes Vбlidos: TH, H, DOP, Vandalismo ");
return 1;
}
if(strcmp(x_apa,"TH",true) == 0)
{
// Funcхes
SendClientMessage(playerid, CORDAMENSAGEM, "Vocк Escreveu /su th й apareceu isso");
return 1;
}
if(strcmp(x_apa,"H",true) == 0)
{
// Funcхes
SendClientMessage(playerid, CORDAMENSAGEM, "Vocк Escreveu /su H й apareceu isso");
return 1;
}
if(strcmp(x_apa,"DOP",true) == 0)
{
// Funcхes
SendClientMessage(playerid, CORDAMENSAGEM, "Vocк Escreveu /su DOP й Apareceu Isso");
return 1;
}
if(strcmp(x_apa,"Vandalismo",true) == 0)
{
// Funcхes
SendClientMessage(playerid, CORDAMENSAGEM, "Vocк Escreveu /su Vandalismo й Apareceu Isso");
return 1;
}
return 1;
}
if(strcmp(cmdtext, "/ir", true,3) == 0) {
new
Float:x,Float:y,Float:z,
escolher[256];
escolher = KcmD(1, cmdtext);
if(!strlen(escolher))
return SendClientMessage(playerid,COLOR_GREEN,"Use: /ir [id]");
GetPlayerPos(strval(escolher),x,y,z);
return SetPlayerPos(playerid,x,y+2,z);
}
stock KcmD(param, cmdtext[])
{
new string[128], pos, var;
format(string, sizeof(string), "%s ", cmdtext);
while((pos = strfind(string, " ", true)) != -1)
{
if(var == param) return string;
var++;
strdel(string, 0, pos + 1);
if(strcmp(string, " ", true, pos) == 0) goto end;
}
end:
string[0] = '\0';
return string;
}
//==========[News]==========
new Procurado[MAX_PLAYERS];
//==========[News]==========
//==========[Cores]==========
#define Azul 0x4682B4
#define Azull 0x5CACEE
#define Vermelho 0xEE0000FF
//==========[Cores]==========
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/HESOYAM", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Veiculo;
Veiculo = GetPlayerVehicleID(playerid);
SetVehicleHealth(Veiculo, 100);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 250000);
SendClientMessage(playerid, Azul, "Truque ativado...");
SendClientMessage(playerid, Azull, "Saъde do Veнculo: 100| Saъde: 100 | Colete: 100 | Dinheiro: +250.000$");
}
else{
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 250000);
SendClientMessage(playerid, Azul, "Truque ativado...");
SendClientMessage(playerid, Azull, "Saъde: 100 | Colete: 100 | Dinheiro: +250.000$");
}
return 1;
}
//Comando para aumentar nнvel de procurado...
if(strcmp(cmdtext, "/OSRNLHH", true) == 0)
{
SetPlayerWantedLevel(playerid, Procurado[playerid]++);
SendClientMessage(playerid, Azul, "Truque ativado...");
return SendClientMessage(playerid, Azulll, "Nнvel de Procurado: +1");
}
return SendClientMessage(playerid, Vermelho, "Comando Invбlido");
}
//=================[ ADMIN SYSTEM ]
#define IsPlayerInAdmins(%0) ((Player[%0][Nivel] > 0)?(true):(false))
#define GetPlayerAdminLevel(%0) Player[%0][Nivel]
#define SetPlayerAdminLevel(%0,%1) Player[%0][Nivel] = %1
enum pInfo
{
bool: Logado,
Nivel,
}
new Player[MAX_PLAYERS][pInfo];
native IsPlayerInAdmin(playerid);
native GetPlayerAdminLevel(playerid);
native SetPlayerAdminLevel(playerid, levelid);