SA-MP Forums Archive
Explain to me line I do not understand PLS - 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: Explain to me line I do not understand PLS (/showthread.php?tid=581451)



Explain to me line I do not understand PLS - noamch1997 - 13.07.2015

UserData[playerid][Guns][GetWeaponSlot(WeaponList[GunNum][WID])] = WeaponList[GunNum][WID];

what this line say ? what value gets each variable ?

TNX guys


Re: Explain to me line I do not understand PLS - Banana_Ghost - 13.07.2015

UserData - enum
playerid - the player that is getting the value
Guns - the field you want to store the variable
Guns (Array) - Holds the value for each gun (weapon)
GetWeaponSlot - Getting the weapon slot of the weapon id stored in WeaponList[GunNum][WID]

= - Telling the player's variable to store the following into it.

WeaponList[GunNum][WID] - The weapon id to store in the Gun Array in that weapons slot.

So with that above, marked:

UserData[playerid][Guns][GetWeaponSlot(WeaponList[GunNum][WID])] = WeaponList[GunNum][WID];
enum-----playerid---Guns-----Guns(Array)----GetWeaponSlot----Weapon id-----Weapon ID to store

(Forums don't like spaces)

PHP код:
UserData[playerid][Guns][GetWeaponSlot(WeaponList[GunNum][WID])] = WeaponList[GunNum][WID];
UserData[playerid][Guns][GetWeaponSlot(WeaponList[GunNum][WID])]
//This is getting the value of 
WeaponList[GunNum][WID
So pretty much, you're saving the weapon id into the player's enumerator data, by the weapon slot, the slot id will hold the weapon id.


Re: Explain to me line I do not understand PLS - noamch1997 - 14.07.2015

Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
UserData - enum
playerid - the player that is getting the value
Guns - the field you want to store the variable
Guns (Array) - Holds the value for each gun (weapon)
GetWeaponSlot - Getting the weapon slot of the weapon id stored in WeaponList[GunNum][WID]

= - Telling the player's variable to store the following into it.

WeaponList[GunNum][WID] - The weapon id to store in the Gun Array in that weapons slot.

So with that above, marked:

UserData[playerid][Guns][GetWeaponSlot(WeaponList[GunNum][WID])] = WeaponList[GunNum][WID];
enum-----playerid---Guns-----Guns(Array)----GetWeaponSlot----Weapon id-----Weapon ID to store

(Forums don't like spaces)

PHP код:
UserData[playerid][Guns][GetWeaponSlot(WeaponList[GunNum][WID])] = WeaponList[GunNum][WID];
UserData[playerid][Guns][GetWeaponSlot(WeaponList[GunNum][WID])]
//This is getting the value of 
WeaponList[GunNum][WID
So pretty much, you're saving the weapon id into the player's enumerator data, by the weapon slot, the slot id will hold the weapon id.
thank you so much man!!