Store string in array
Hi, I am very new at scripting, I want to know how to write and read string from array, like assign string to player id and retrieve it.
I had this: Code:
new playerSaved[33] EDIT: First error was that I must gave specified length on the string stored in array like Code:
new playerSaved[33][64] Code:
if(equali(playerSaved[id], "weapon_m4a1")) I am using this plugin with simplemenu: https://forums.alliedmods.net/showthread.php?t=284324 and in simplemenu's settings, calling do.func(buymenu_helper.amxx, get_weapon_ak47) on item selection and it works like a charm 1. New Guns (amx_buy_new) 2. Previous Guns (do.func(buymenu_helper.amxx, getPreviousGuns)) 3. Previous Guns & Save (do.func(buymenu_helper.amxx, getPreviousGunsDisable)) Code:
#include <amxmodx> |
Re: Store string in array
Generally, if you solve your own problem you should post the solution and/or links that help you figure it out and then create a new thread for your new topic. The other benefit to posting a new thread is that people who have already seen this thread will actually see the new thread as new (they won't see this thread again until someone else posts a reply).
FYI. I'm quite sure there is a bunch of information on this forum about unlimited ammo. The Scripting Help forum is for writing or editing plugins not for asking for links to plugins. |
Re: Store string in array
Quote:
P.S. about unlimited ammo, yeah, there are lots of plugins, but I want unlimited backpack ammo plugin, couldn't find anything is approved plugins section, tried several but none was working |
Re: Store string in array
btw, any idea how to make it more portable, like instead of doing new function for each weapon, pass name as a 3rd parameter from simplemenu plugin and process it in one default function for all guns
|
Re: Store string in array
It would be best to store the CSW_ weapon ID in the array instead of weapon name. Doing this, you can build an array to store info for each weapon, though you can get away with using the weapon name by using the get_weaponid() native. Keep in mind that the array must be built so that the weapon ID corresponds to the appropriate slot in the array, as outlined below.
PHP Code:
|
All times are GMT -4. The time now is 06:29. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.