SA-MP Forums Archive
Helpp To Give Random Weapon and Restore all ammo weap - 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: Helpp To Give Random Weapon and Restore all ammo weap (/showthread.php?tid=534518)



Helpp To Give Random Weapon and Restore all ammo weap - FloxX - 30.08.2014

for(new i= 0; i < sizeof(pickup_Ammo); i++)
if(pickupid == pickup_Ammo[i])
{
new Float:ammo;
GetPlayerAmmo(playerid, ammo);
SetPlayerAmmo(playerid, ammo+25);
}
for(new i= 0; i < sizeof(pickup_Gun); i++)
if(pickupid == pickup_Gun[i])
{
new gun = random(40);
GetPlayerArmour(playerid, gun);
SetPlayerArmour(playerid, gun);
}

ERROR
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(237 : warning 202: number of arguments does not match definition
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(2379) : warning 213: tag mismatch
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(2379) : warning 202: number of arguments does not match definition
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(2385) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
GetPlayerAmmo(playerid, ammo);
SetPlayerAmmo(playerid, ammo+25);
GetPlayerWeapon(playerid, gun);
GivePlayerWeapon(playerid, gun);

I Want to restore All Weapon Ammo if player pickup_Ammo
I Want to Give Random Weapon After Pickup_Gun


Re: Helpp To Give Random Weapon and Restore all ammo weap - DavidBilla - 30.08.2014

pawn Код:
for(new i= 0; i < sizeof(pickup_Ammo); i++)
if(pickupid == pickup_Ammo[i])
{
new ammo=GetPlayerAmmo(playerid);
SetPlayerAmmo(playerid, ammo+25);
}
for(new i= 0; i < sizeof(pickup_Gun); i++)
if(pickupid == pickup_Gun[i])
{
new gun = GetPlayerWeapon(playerid);
SetPlayerWeapon(playerid, gun);
}
Try it.
Idk what you meant with random(40),if you explain what you wanted you wanted to do with that line,I'll help with that too


Re: Helpp To Give Random Weapon and Restore all ammo weap - FloxX - 30.08.2014

Random(40) the id Weapon 1~ 40 right ? or no ?


Re: Helpp To Give Random Weapon and Restore all ammo weap - FloxX - 30.08.2014

why i ge this yeah ? after i compiled the gamemode
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(237 : warning 202: number of arguments does not match definition
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(2384) : error 017: undefined symbol "SetPlayerWeapon"
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(2384) : warning 202: number of arguments does not match definition
D:\AlexaGaming\gamemodes\AlexaaGaming.pwn(2384) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


Re: Helpp To Give Random Weapon and Restore all ammo weap - DavidBilla - 30.08.2014

pawn Код:
for(new i= 0; i < sizeof(pickup_Ammo); i++)
if(pickupid == pickup_Ammo[i])
{
new ammo=GetPlayerAmmo(playerid);
new gun=GetPlayerWeapon(playerid);
SetPlayerAmmo(playerid,gun,ammo+25);
}
for(new i= 0; i < sizeof(pickup_Gun); i++)
if(pickupid == pickup_Gun[i])
{
GivePlayerWeapon(playerid,1+Random(39),1+Random(25));
}
Try this one.
You'll get any random weapon with a random of 1-25 ammo in it.


Re: Helpp To Give Random Weapon and Restore all ammo weap - FloxX - 30.08.2014

DavidBilla

if you want random ? Dont you write "Random" Because no effect , random <<< effect


Re: Helpp To Give Random Weapon and Restore all ammo weap - DavidBilla - 31.08.2014

Sorry my bad,after changing it to random, is it working fine or is it showing up any errors?