SA-MP Forums Archive
How would I.....?(Defining) - 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: How would I.....?(Defining) (/showthread.php?tid=302133)



How would I.....?(Defining) - Dokins - 07.12.2011

Alright, I've seen this in a script:

/house store weapon weaponname

the problem is the weapon name, how do I define the name for each weapon id and check that the player actually has it? so i.e

/house store weapon ak47

How do I define it to the correct ID so it inserts it to mysql and then remove the weapon from the player. The actual issue is just how to define it.
I want basically is a function that:

knows weapon names i.e

Desert Eagle = 24.

So when a player types something like:

/give weapon playerid Desert Eagle, it gives them a deserteagle according to its ID.


Re: How would I.....?(Defining) - xMichaelx - 07.12.2011

store the weapons using varibles and then just update via MySQL

EDIT: didnt read the name right, you would need a stock function i guess, with the weapon ids then there names


Re: How would I.....?(Defining) - Dokins - 07.12.2011

Would it be strcmp or?


Re: How would I.....?(Defining) - xMichaelx - 07.12.2011

I guess so,


Re: How would I.....?(Defining) - Dokins - 07.12.2011

Can someone else help please?


Re: How would I.....?(Defining) - Thresholdold - 07.12.2011

I don't know if strcmp is the best way to do it... but I can't be sure with other methods, as I'm not very resourceful when it comes to using MySQL or ZCmd...


Re: How would I.....?(Defining) - Dokins - 07.12.2011

No all I want basically is a function that:

knows weapon names i.e

Desert Eagle = 24.

So when a player types something like:

/give weapon playerid Desert Eagle, it gives them a deserteagle according to its ID.


Re: How would I.....?(Defining) - xMichaelx - 07.12.2011

Why not look into the way vehicle names are stored? Change it around into weapon names.


Re: How would I.....?(Defining) - Dokins - 07.12.2011

That doesnt really help, sorry.


Re: How would I.....?(Defining) - Pinguinn - 07.12.2011

You can use an enum for that