add params later on in command - 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: add params later on in command (
/showthread.php?tid=656882)
add params later on in command -
NoteND - 26.07.2018
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..
Re: add params later on in command -
Dayrion - 26.07.2018
/setadmin [id] [level] [optional: title]
and add a default value to title?
Re: add params later on in command -
NoteND - 26.07.2018
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?
Re: add params later on in command -
JasonRiggs - 26.07.2018
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]", id, level, title))
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]");
}
Re: add params later on in command -
JasonRiggs - 26.07.2018
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?
Re: add params later on in command -
JasonRiggs - 26.07.2018
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?
Re: add params later on in command -
Dayrion - 27.07.2018
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]", id, level, title)) // I don't think your title is 128 characters long