add params later on in command
#1

Hey!

Im stuck in position here.. currently have a command /setadmin [id] [level].. but if(level == 6) I want to add
another param to decide whether that level 6 admin will have title1 or title2.. how do I add anothe param in that case..
Reply
#2

/setadmin [id] [level] [optional: title]
and add a default value to title?
Reply
#3

ye but if I got.. if(sscanf(params, "uus[128]", id, level, title)) etc.. then I'd have to set title for every level right?
Reply
#4

You should make at the beginning an optional param "S[128]"

So change your first sscanf params to this..

PHP код:
if(sscanf(params"uuS[128]"idleveltitle)) 
And add an exception in ur command..

PHP код:
if(level ==6)
{
     if(
sscanf(params"s[128]"title)) return SendClientMessage(playerid, -1"/makeadmin [playerid] 6 [title]");

Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
You don't need the second sscanf, and you do need a default value.
Isn't that what I've done?
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
No, that's the exact opposite of what you've done. You have two sscanfs and neither has a default value.
ye sorry didn't notice..


PHP код:
if(level ==6)
{
     if(
sscanf(title"s[128]"titlename)) return SendClientMessage(playerid, -1"/makeadmin [playerid] 6 [title]");

Is that right, now?
Reply
#7

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
ye sorry didn't notice..


PHP код:
if(level ==6)
{
     if(
sscanf(title"s[128]"titlename)) return SendClientMessage(playerid, -1"/makeadmin [playerid] 6 [title]");

Is that right, now?
I don't think so.
PHP код:
if(sscanf(params"uiS()[30]"idleveltitle))  // I don't think your title is 128 characters long 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)