A cmd that affects others. - 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: A cmd that affects others. (
/showthread.php?tid=270500)
A cmd that affects others. -
Facepunch - 20.07.2011
So i'm on my journey of scripting my own rp server. And I've come to a point where I want to create commands that'll affect other people. For example. I'm currently using the gTeam to create factions, i'd like to create a cmd that looks something like this:
/setfaction (playerid) (faction)
Get what I mean?
Anyways, thanks in advance!
Best regards
Facepunch
Re: A cmd that affects others. -
pantelimonfl - 20.07.2011
I recommend you to use ZCMD & SSCANF2. It will be harder at the beginning but easier and more efficiently later.
Re: A cmd that affects others. -
Dark.Angel - 20.07.2011
pawn Код:
if (strcmp(cmdtext,"/setfaction",true) == 0)
{
new playerid2;new factionid;
tmp = strtok(cmdtext,idx);
playerid = strval(tmp);
if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Use: /setfaction [playerid] [faction]");
tmp = strtok(cmdtext,idx);
factionid = strval(tmp);
if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Use: /setfaction [playerid] [faction]");
// Functions to set playerid2 in a faction
return true;
}
Re: A cmd that affects others. -
Facepunch - 20.07.2011
Quote:
Originally Posted by pantelimonfl
I recommend you to use ZCMD & SSCANF2. It will be harder at the beginning but easier and more efficiently later.
|
I'll see if I can find any tutorials related to ZCMD and SSCANF2, if you have anything, that'd be great.
Quote:
Originally Posted by Dark.Angel
pawn Код:
if (strcmp(cmdtext,"/setfaction",true) == 0) { new playerid2;new factionid; tmp = strtok(cmdtext,idx); playerid = strval(tmp); if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Use: /setfaction [playerid] [faction]"); tmp = strtok(cmdtext,idx); factionid = strval(tmp); if (!strlen(tmp)) return SendClientMessage(playerid,-1,"Use: /setfaction [playerid] [faction]"); // Functions to set playerid2 in a faction return true; }
|
Could you explain to me further how this works?
I'm sorry, but i've never really worked with tmp and idx. My pawn says that tmp and idx isn't defined.
So since I have no experience in this field, I don't know how to define these two fellas.
Best regards,
FacePunch
Re: A cmd that affects others. -
pantelimonfl - 20.07.2011
https://sampforum.blast.hk/showthread.php?tid=244841 i learnt them on this tut.
Re: A cmd that affects others. -
Facepunch - 20.07.2011
Quote:
Originally Posted by pantelimonfl
|
Thank you, this is perfect!
But I also thank you all for your help!
Kindest regards,
Facepunch