Something wrong - 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: Something wrong (
/showthread.php?tid=617987)
Something wrong -
NealPeteros - 29.09.2016
Hi, guys! Need help here. Is there something wrong with this command? Whenever I use it to a person, it repeats the command usage. Here's the command
PHP код:
CMD:vipset(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] == 5)
{
new Target;
if(!sscanf(params, "us[32]",Target))
{
if(!IsPlayerConnected(Target))
return SendClientMessage(playerid, red, "Player is not connected!");
new tname[MAX_PLAYER_NAME];
new pname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
GetPlayerName(playerid,pname,sizeof(pname));
if(VipSet[playerid] == false)
{
PlayerInfo[playerid][pVip] = 1;
GameTextForPlayer(playerid, "~W~VIP status ~g~added to the selected player", 5000, 5);
VipSet[playerid] = true;
}else{
PlayerInfo[playerid][pVip] = 0;
GameTextForPlayer(playerid, "~W~VIP status ~r~removed to the selected player", 5000, 5);
VipSet[playerid] = false;
}
}
else return SendClientMessage(playerid, red, "USAGE: /vipset <playerid>/<player name>");
return true;
}
else return 0;
}
Re: Something wrong -
NealPeteros - 29.09.2016
Actually all cmds in the script that needs the target id have that error.
Re: Something wrong -
luke49 - 29.09.2016
Why are you using two specifiers
u and
s for
Target?
PHP код:
if(!sscanf(params, "u",Target))
Re: Something wrong -
Dayrion - 29.09.2016
You are missing one variable. You put us[32] and 1 one variable.
PHP код:
CMD:vipset(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] == 5)
{
new Target, missingvariable[32+EOS];
if(!sscanf(params, "us[32]",Target, missingvariable))
{
if(!IsPlayerConnected(Target))
return SendClientMessage(playerid, red, "Player is not connected!");
new tname[MAX_PLAYER_NAME];
new pname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
GetPlayerName(playerid,pname,sizeof(pname));
if(VipSet[playerid] == false)
{
PlayerInfo[playerid][pVip] = 1;
GameTextForPlayer(playerid, "~W~VIP status ~g~added to the selected player", 5000, 5);
VipSet[playerid] = true;
}else{
PlayerInfo[playerid][pVip] = 0;
GameTextForPlayer(playerid, "~W~VIP status ~r~removed to the selected player", 5000, 5);
VipSet[playerid] = false;
}
}
else return SendClientMessage(playerid, red, "USAGE: /vipset <playerid>/<player name>");
return true;
}
else return 0;
}
Re: Something wrong -
Threshold - 29.09.2016
PHP код:
CMD:vipset(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] != 5) return 0;
new Target;
if(sscanf(params, "u",Target)) return SendClientMessage(playerid, red, "USAGE: /vipset <playerid>/<player name>");
if(!IsPlayerConnected(Target)) return SendClientMessage(playerid, red, "Player is not connected!");
GameTextForPlayer(playerid, (VipSet[playerid]) ? ("~W~VIP status ~r~removed to the selected player") : ("~W~VIP status ~g~added to the selected player"), 5000, 5);
PlayerInfo[playerid][pVip] = !PlayerInfo[playerid][pVip];
VipSet[playerid] = !VipSet[playerid];
return 1;
}
Just for fun
Re: Something wrong -
NealPeteros - 29.09.2016
Just found out something new. Every time I use those commands, it says "sscanf error: System not initialised." in the server log. Outdated plugin?
Re: Something wrong -
NealPeteros - 29.09.2016
Yup. It's an outdated plugin. Thanks to all!