SA-MP Forums Archive
Sscanf and Zcmd question - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Sscanf and Zcmd question (/showthread.php?tid=254416)



Sscanf and Zcmd question - sim_sima - 10.05.2011

Hey guys.
Im makeing a RPG gamemode.
I want a command for getting a job.
When you are in a job centre, and type "/job <jobname>"
like /job trucker. How can i do that?

Hope someone will help me. Thanks.


Re: Sscanf and Zcmd question - Zh3r0 - 10.05.2011

pawn Код:
CMD:job(playerid,params[])
{
     if(ssacnf(params, "s[30]", params[0]))return SendClientMessage(playerid, ~1, "USAGE: /job <job> (trucker/driver)");
     if(!strcmp(params[0], "trucker", true))
     {
           //Trucker code
     }
     else if(!strcmp(params[0], "driver", true))
     {
           //Driver code.
     }else SendClientMessage(playerid, ~1, "USAGE: /job <job> (trucker/driver)");
     return 1;
}



Re: Sscanf and Zcmd question - sim_sima - 10.05.2011

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
pawn Код:
CMD:job(playerid,params[])
{
     if(ssacnf(params, "s[30]", params[0]))return SendClientMessage(playerid, ~1, "USAGE: /job <job> (trucker/driver)");
     if(!strcmp(params[0], "trucker", true))
     {
           //Trucker code
     }
     else if(!strcmp(params[0], "driver", true))
     {
           //Driver code.
     }else SendClientMessage(playerid, ~1, "USAGE: /job <job> (trucker/driver)");
     return 1;
}
Thank you very much!! Love you <3


Re: Sscanf and Zcmd question - Gh0sT_ - 10.05.2011

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
pawn Код:
CMD:job(playerid,params[])
{
     if(ssacnf(params, "s[30]", params[0]))return SendClientMessage(playerid, ~1, "USAGE: /job <job> (trucker/driver)");
     if(!strcmp(params[0], "trucker", true))
     {
           //Trucker code
     }
     else if(!strcmp(params[0], "driver", true))
     {
           //Driver code.
     }else SendClientMessage(playerid, ~1, "USAGE: /job <job> (trucker/driver)");
     return 1;
}
um, 30?
trucker is 7 chars so + 1 = 8
driver is 6 chars so + 1 = 7

so why you use 30 instead of 7-8-9?