SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/02/2019, 03:26 PM   #1
masterart
Little Clucker
 
Join Date: Feb 2019
Posts: 24
Reputation: 0
Default when i enter an invalid id

pawn Code:
CMD:makeadmin(playerid,params[])
{
    new level, id, name[24], string[72], targetid;
    if(!IsPlayerAdmin(playerid)) return 1;
    if(sscanf(params, "ui", playerid, level)) return SendClientMessage(playerid, -1, "USAGE: /makeadmin [playerid] [1-5]");
    if(level < 0 || level > 5) return SendClientMessage(playerid, -1, "USAGE: /makeadmin [playerid] [1-5]");
    if(!IsPlayerConnected(id)) return 1;
    GetPlayerName(targetid, name, sizeof(name));
    format(string, sizeof(string), "NOTICE: You have given %s admin rights.", name);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "NOTICE: %s has given you admin rights.", name);
    SendClientMessage(targetid, -1, string);
    PlayerInfo[playerid][pAdmin] = level;
    return 1;
}

when i enter an invalid id it returns "masterart has given you admin rights" followed by "Server: Unknown Command". what am i doing wrong?
masterart is offline   Reply With Quote
Old 11/02/2019, 03:40 PM   #2
PepsiCola23
Gangsta
 
Join Date: May 2015
Posts: 726
Reputation: 3
Default Re: when i enter an invalid id

Quote:
Originally Posted by masterart View Post
pawn Code:
CMD:makeadmin(playerid,params[])
{
    new level, id, name[24], string[72], targetid;
    if(!IsPlayerAdmin(playerid)) return 1;
    if(sscanf(params, "ui", playerid, level)) return SendClientMessage(playerid, -1, "USAGE: /makeadmin [playerid] [1-5]");
    if(level < 0 || level > 5) return SendClientMessage(playerid, -1, "USAGE: /makeadmin [playerid] [1-5]");
    if(!IsPlayerConnected(id)) return 1;
    GetPlayerName(targetid, name, sizeof(name));
    format(string, sizeof(string), "NOTICE: You have given %s admin rights.", name);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "NOTICE: %s has given you admin rights.", name);
    SendClientMessage(targetid, -1, string);
    PlayerInfo[playerid][pAdmin] = level;
    return 1;
}

when i enter an invalid id it returns "masterart has given you admin rights" followed by "Server: Unknown Command". what am i doing wrong?
you used playerid in sscanf params instead of id
PepsiCola23 is offline   Reply With Quote
Old 11/02/2019, 03:47 PM   #3
masterart
Little Clucker
 
Join Date: Feb 2019
Posts: 24
Reputation: 0
Default Re: when i enter an invalid id

Quote:
Originally Posted by PepsiCola23 View Post
you used playerid in sscanf params instead of id
o wow, thanks!
masterart is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hello i want /enter and /exit used whit [ F Or Enter ] For enter to house or biz rezapalang Scripting Help 5 10/04/2017 05:51 AM
how to enter the building or door by pressing the enter key kurniarocki Scripting Help 7 08/04/2014 08:03 AM
Weird error: invalid symbol name and invalid function or declaration Reboma Scripting Help 1 04/02/2014 11:58 AM
[Tutorial] /enter -- Making a simple enter command. EvanA Tutorials 7 17/11/2013 05:54 PM
how to create an /exit and /enter command to enter an costum interior? sandisk125 Help Archive 5 18/08/2009 02:07 PM


All times are GMT. The time now is 10:28 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.