Something wrong
#1

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(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] == 5)
    {
    new 
Target;
    if(!
sscanf(params"us[32]",Target))
    {
    if(!
IsPlayerConnected(Target))
    return 
SendClientMessage(playeridred"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"50005);
    
VipSet[playerid] = true;
    }else{
    
PlayerInfo[playerid][pVip] = 0;
    
GameTextForPlayer(playerid"~W~VIP status ~r~removed to the selected player"50005);
    
VipSet[playerid] = false;
    }
    }
    else return 
SendClientMessage(playeridred"USAGE: /vipset <playerid>/<player name>");
    return 
true;
    }
    else return 
0;

Reply
#2

Actually all cmds in the script that needs the target id have that error.
Reply
#3

Why are you using two specifiers u and s for Target?
PHP код:
if(!sscanf(params"u",Target)) 
Reply
#4

You are missing one variable. You put us[32] and 1 one variable.
PHP код:
CMD:vipset(playeridparams[]) 

    if (
PlayerInfo[playerid][pAdmin] == 5
    { 
    new 
Targetmissingvariable[32+EOS]; 
    if(!
sscanf(params"us[32]",Targetmissingvariable)) 
    { 
    if(!
IsPlayerConnected(Target)) 
    return 
SendClientMessage(playeridred"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"50005); 
    
VipSet[playerid] = true
    }else{ 
    
PlayerInfo[playerid][pVip] = 0
    
GameTextForPlayer(playerid"~W~VIP status ~r~removed to the selected player"50005); 
    
VipSet[playerid] = false
    } 
    } 
    else return 
SendClientMessage(playeridred"USAGE: /vipset <playerid>/<player name>"); 
    return 
true
    } 
    else return 
0

Reply
#5

PHP код:
CMD:vipset(playeridparams[]) 

    if(
PlayerInfo[playerid][pAdmin] != 5) return 0;
    new 
Target;
    if(
sscanf(params"u",Target)) return SendClientMessage(playeridred"USAGE: /vipset <playerid>/<player name>");
    if(!
IsPlayerConnected(Target)) return SendClientMessage(playeridred"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"), 50005);
    
PlayerInfo[playerid][pVip] = !PlayerInfo[playerid][pVip];
    
VipSet[playerid] = !VipSet[playerid];
    return 
1;

Just for fun
Reply
#6

Just found out something new. Every time I use those commands, it says "sscanf error: System not initialised." in the server log. Outdated plugin?
Reply
#7

Yup. It's an outdated plugin. Thanks to all!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)