if(strcmp(cmd, "/id", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /id [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerNameEx(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "Name: %s, ID: %d", giveplayer, giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
else
{
format(string, sizeof(string), " %d is not an active player !", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
How can i make this
PHP код:
|
dcmd_id(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /id [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerNameEx(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "Name: %s, ID: %d", giveplayer, giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
else
{
format(string, sizeof(string), " %d is not an active player !", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(id, 2, cmdtext);
return 1;
}
#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
Fucks Sake!! ZCMD I Mean! Please, Thanks anyway ^ + Rep for you, but i need ZCMD.. Fail :P
|
CMD:id(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(params, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /id [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerNameEx(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "Name: %s, ID: %d", giveplayer, giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
else
{
format(string, sizeof(string), " %d is not an active player !", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
Here's the zcmd one:
pawn Код:
|