MoveObject with a password - 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: MoveObject with a password (
/showthread.php?tid=407503)
MoveObject with a password -
Mattakil - 14.01.2013
this may be the easiest thing but I am a noob soo... I got a moveobject system created for gates and shit but anyone can open it. I am looking for a way to set the password so if it was like derp, you go to the gate, do /gate open derp and it will open. If it is the wrong command SendClientMessage Wrong Code. If it is easier, a dialogue would be just as good.
Re: MoveObject with a password -
LarzI - 14.01.2013
If you use sscanf, you could make something like this:
pawn Код:
CMD:gate(playerid, params[])
{
new
subcmd[ 6 ],
password;
if( sscanf( params, "ss", subcmd, password ))
return SendClientMessage( playerid, 0xFF0000FF, "/gate [open/close] [password]" );
if( !strcmp( subcmd, "open", true ))
{
if( !strcmp( password, "MYPASSWORD" ))
{
//open gate
}
}
else
{
//close gate
}
return true;
}
Re: MoveObject with a password -
[HiC]TheKiller - 14.01.2013
Quote:
Originally Posted by LarzI
If you use sscanf, you could make something like this:
pawn Код:
CMD:gate(playerid, params[]) { new subcmd[ 6 ], password;
if( sscanf( params, "ss", subcmd, password )) return SendClientMessage( playerid, 0xFF0000FF, "/gate [open/close] [password]" );
if( !strcmp( subcmd, "open", true )) { if( !strcmp( password, "MYPASSWORD" )) { //open gate } } else { //close gate } return true; }
|
Password should be a string + sscanf (if you're using the plugin) requires string sizes

.
Re: MoveObject with a password -
LarzI - 14.01.2013
Yeah sorry 'bout that - I had just woken up and was really tired.