SA-MP Forums Archive
What's wrong here? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's wrong here? (/showthread.php?tid=493573)



What's wrong here? - TheSnaKe - 09.02.2014

Hey guys, i will send my code, when am using /jetpack it says Invalid player specified but it's correct id i was id 0. So here is my code. So what's wrong with this, i can see in the code that everything is going well, but maybe i have a mistake, can you help me please. Thanks.

Код:
}

CMD:jetpack(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 4) {
		JetPack[playerid] = 1;
		SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
		return 1;
	}
	new string[128], plo;
	if(sscanf(params, "u", plo)) {
		SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /jetpack [playerid]");
		return 1;
	}
	if (IsPlayerConnected(plo)) {
		if(plo != INVALID_PLAYER_ID) {
			if (PlayerInfo[playerid][pAdmin] >= 4) {
				SendClientMessageEx(plo, COLOR_GRAD1, "Jetpack Given!");
				JetPack[plo] = 1;
				SetPlayerSpecialAction(plo, SPECIAL_ACTION_USEJETPACK);
				format(string, sizeof(string), "[TDM]: %s has received a jetpack from %s", GetPlayerNameEx(plo), GetPlayerNameEx(playerid));
				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
			}
			else {
				SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
			}
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	return 1;
}



Re: What's wrong here? - Crypto20 - 09.02.2014

Try this:
PHP код:
CMD:jetpack(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= && PlayerInfo[playerid][pAdmin] < 4) {
        
JetPack[playerid] = 1;
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
        return 
1;
    }
    new 
string[128], plo;
    if(
sscanf(params"u"plo)) {
        
SendClientMessageEx(playeridCOLOR_GRAD2"USAGE: /jetpack [playerid]");
        return 
1;
    }
    if (
IsPlayerConnected) {
        if(
plo != INVALID_PLAYER_ID) {
            if (
PlayerInfo[playerid][pAdmin] >= 4) {
                
SendClientMessageEx(ploCOLOR_GRAD1"Jetpack Given!");
                
JetPack[plo] = 1;
                
SetPlayerSpecialAction(ploSPECIAL_ACTION_USEJETPACK);
                
format(stringsizeof(string), "[TDM]: %s has received a jetpack from %s"GetPlayerNameEx(plo), GetPlayerNameEx(playerid));
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
            }
            else {
                
SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command!");
            }
        }
    }
    else 
SendClientMessageEx(playeridCOLOR_GRAD1"Invalid player specified.");
    return 
1;
}
    return 
1;




Re: What's wrong here? - Threshold - 09.02.2014

pawn Код:
CMD:jetpack(playerid, params[])
{
    new level = PlayerInfo[playerid][pAdmin];
    if(level < 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    if(level < 4)
    {
        JetPack[playerid] = 1;
        return SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
    }
    new plo;
    if(!strlen(params)) plo = playerid;
    else if(sscanf(params, "u", plo)) return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /jetpack [playerid]");
    if(!IsPlayerConnected(plo) || plo == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    SendClientMessageEx(plo, COLOR_GRAD1, "Jetpack Given!");
    JetPack[plo] = 1;
    SetPlayerSpecialAction(plo, SPECIAL_ACTION_USEJETPACK);
    new string[85];
    format(string, sizeof(string), "[TDM]: %s has received a jetpack from %s", GetPlayerNameEx(plo), GetPlayerNameEx(playerid));
    SendClientMessageToAllEx(COLOR_LIGHTRED, string);
    return 1;
}
EDIT: 1000th post! WOOT!


Re: What's wrong here? - TheSnaKe - 09.02.2014

Oh, i found that the most of my commands got this error Invalid player specified ,oh god, but it was working before, i don't know what happens, what i have to do to fix this?


Re: What's wrong here? - Threshold - 09.02.2014

It would seem that you most likely have to update your sscanf plugin. That's normally the cause of errors like this.