SA-MP Forums Archive
How do I call these variables properly? - 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: How do I call these variables properly? (/showthread.php?tid=149851)



How do I call these variables properly? - plutoniumman - 23.05.2010

Hello everyone

I'm trying to program a basic script that'll give weapons to people when they type: "/gw [player id] [weapon id] [ammo]"

Here's the code I got so far:
Код:
  
new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index),tmp2 = strtok(params,Index),tmp3 = strtok(params,Index);
GivePlayerWeapon(tmp[0], tmp2[0], tmp3[0]);
printf("%i %i %i", tmp, tmp2, tmp3);
The player never gets the weapon and printf returns a value completely different than what the user entered.
Like my other scripts, I'm pretty sure it's to do with the way I'm initializing or calling the variables. If I could just get this whole variable thing down I'd be good to go and not bothering you guys lol

Any help or tips are greatly appriciated


Re: How do I call these variables properly? - [HiC]TheKiller - 23.05.2010

I'd reccomend for you to try DCMD + sscanf.