SA-MP Forums Archive
Weapon array - 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: Weapon array (/showthread.php?tid=382395)



Weapon array - CoDeZ - 03.10.2012

Hello, i am creating a duel system, and this is my sscanf line
pawn Код:
if(sscanf(params,"us[20]d",PID,sWeapon,Money))
I want to create a weapon array and add specific weapons, then to check if entered weapon = "sWeapon"
How to do that?


Re: Weapon array - CoDeZ - 03.10.2012

Quote:
Originally Posted by SaYrOn
Посмотреть сообщение
Create weapon array, under command add string variable( weapon[20], for example), and then do a loop something like:

Код:
for(new i; i < sizeof(sWeapons); i++)
{
       if(strcmp(sWeapons[i], weapon) == 0)
       {
                   // Do smth if weapon that player entered is same with some weapon from the array
       }
}
Will try it thanks RPed.
Quote:
Originally Posted by ******
Посмотреть сообщение
I would say look up the "k" specifier to write a custom sscanf specifier.
Didn't know i can write a custom specifier :O
Thanks i'll take a look about sscanf topic.