Need help with my Jetpack command.
#5

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
This should work:

pawn Код:
CMD:jetpack(playerid, params[])
{
new targetid[MAX_PLAYER_NAME]; new string[256];
if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid, "You're not an Administrator Level 2");
    {
    else if(IsPlayerConnected(playerid)
        {
        if(sscanf(params,"u",targetid)) SendClientMessage(playerid,"Usage: /jetpack (ID/Name);");
            {
            GetPlayerName(playerid, targetid);
            format(string,sizeof(string),"An administrator has given a jetpack to %s", targetid);
            SendClientMessageToAll(-1, string);
            GivePlayerJetpack(targetid);
  return 1;
 }
No it wont.

This will:

pawn Код:
CMD:jetpack(playerid, params[])
{
new targetidname[MAX_PLAYER_NAME],targetid; new string[256];
if(PlayerInfo[playerid][pAdmin] >= 2)
    {
    if(IsPlayerConnected(playerid))
        {
        if(!sscanf(params,"u",targetid))
            {
            GetPlayerName(targetid, targetidname, sizeof(targetidname));
            format(string,sizeof(string),"An administrator has given a jetpack to %s", targetidname);
            SendClientMessageToAll(-1, string);
            GivePlayerJetpack(targetid);
            }
            else return SendClientMessage(playerid,1,"Usage: /jetpack (ID/Name);");
        }
    }
    else return SendClientMessage(playerid, "You're not an Administrator Level 2");
  return 1;
 }
I just can't imagine how many errors you would get with XtremeR's code.
This will help him:

1-Missing closing brackets
2-You had a else if without and if statement above
3-Your returning messages would not do anything
4-GetPlayerName missed something
5-Forgot a closing ) after IsPlayerConnected
6-Where sscanf check the intered text, it would be inversed

EDIT:The man above me was faster, but anyways. Your last change, "GivePlayerJetpack" removed, maybe he has a function for it where it sets the special action in
Reply


Messages In This Thread
Need help with my Jetpack command. - by Magic_Time - 27.12.2012, 05:35
Re: Need help with my Jetpack command. - by XtremeR - 27.12.2012, 05:43
Re: Need help with my Jetpack command. - by Magic_Time - 27.12.2012, 05:48
Re: Need help with my Jetpack command. - by zDevon - 27.12.2012, 05:50
Re : Re: Need help with my Jetpack command. - by lelemaster - 27.12.2012, 05:53
Re: Need help with my Jetpack command. - by Magic_Time - 27.12.2012, 05:56
Re : Need help with my Jetpack command. - by lelemaster - 27.12.2012, 05:57
Re: Need help with my Jetpack command. - by Magic_Time - 27.12.2012, 06:01
Re : Re: Need help with my Jetpack command. - by lelemaster - 27.12.2012, 06:01
Re: Need help with my Jetpack command. - by zDevon - 27.12.2012, 06:12

Forum Jump:


Users browsing this thread: 1 Guest(s)