How do I call these variables properly?
#1

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
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)