Problem with this 2 cmds -
Face9000 - 23.03.2012
Hello guys,i've coded this commands and both have same problem.It works only for ID 0,what's wrong?SSCANF is updated.
pawn Код:
CMD:gall(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new Float:x;
new Float:y;
new Float:z;
new targetid;
new string[130];
for(new i=0; i<MAX_PLAYERS; i++)
if(IsPlayerConnected(i)) {
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(i,x,y,z+10);
new pName[24];
GetPlayerName(targetid,pName,128);
format(string, sizeof(string), "Admin %s (%d) has teleported all players to his location.",pName,targetid);
SendClientMessageToAll(red,string);
}
return true;
}
else return 0;
}
CMD:info(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
new string[256], giveplayerid;
new Float:gihp, Float:giar;
GetPlayerHealth(giveplayerid, gihp);
GetPlayerArmour(giveplayerid, giar);
GetPlayerName(giveplayerid,string,sizeof(string));
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /info [ID/PartOfName]");
if(IsPlayerConnected(giveplayerid))
{
format(string, sizeof(string), "Cash: %i$ - Current Wanted Level: %d - Admin Level: %d - Kills: %i - Deaths: %i - Health: %0.1f - Armour: %0.1f -",PlayerInfo[playerid][pCash],PlayerInfo[playerid][pWantedLevel],PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],gihp,giar);
SendClientMessage(playerid, yellow, string);
}
else
{
SendClientMessage(playerid, red, "Invalid player specified.");
}
return true;
}
else return 0;
}
Re: Problem with this 2 cmds -
park4bmx - 23.03.2012
to tele all players to the admin
pawn Код:
CMD:info(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid, red, "Not Allowed to use this CMD");//change it
new string[128];GetPlayerName(playerid, playrname, sizeof(playrname));
format(string, sizeof(string), "Admin %s (%d) has teleported all players to his location.", playrname,playerid);
SendClientMessageToAll(COLOR_YELLOW, string);
new Float:X,Float:Y, Float:Z;
GetPlayerPos(playerid,X,Y,Z);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) SetPlayerPos(i,X+2,Y,Z+2);
}
return 1;
}
EDIT
the status cmd looks fine
but could try making the string more neater, maybe puting the items line aftter line.
Re: Problem with this 2 cmds -
BigD - 23.03.2012
pawn Код:
new
userID;
if(sscanf(params, "u", userID)) {
return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/get [playerid]");
}
else {
if(userID == INVALID_PLAYER_ID)
return SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated.");
try adding that to fit your script
Re: Problem with this 2 cmds -
Face9000 - 23.03.2012
Fixed.