help with store weapons - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with store weapons (
/showthread.php?tid=51257)
help with store weapons -
Philip - 18.09.2008
i add Carmod mode for trunk storing weapons i try to store the weapons they say you can`t open the trunk ....
here the codes
Код:
if(!strcmp("/storeweapon", cmdtext, true))
{
new counter = 0
new result
new plyName[MAX_PLAYER_NAME]
GetPlayerName(playerid, plyName, MAX_PLAYER_NAME)
for(new i; i != MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(5.0, playerid, i)
if(dist)
{
result = i
counter++
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, 0xFF0000FF, "[CARMOD] No car located near you.")
}
case 1:
{
if(vehTrunkCounter[result] != (MAX_TRUNK_SLOTS-1))
{
if(!IsPlayerInAnyVehicle(playerid))
{
new buffer[512]
new gunname[100]
new gunID = GetPlayerWeapon(playerid)
new gunAmmo = GetPlayerAmmo(playerid)
new plyWeapons[12]
new plyAmmo[12]
if(gunID != 0)
{
GetWeaponName(gunID, gunname, sizeof(gunname))
// Step 1: Store all the players guns (except for the one being put in the car.)
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo
GetPlayerWeaponData(playerid, slot, wep, ammo)
if(wep != gunID)
{
GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot])
}
}
// Step 2: Store the gun being put in the car and display the message.
vehTrunkCounter[result]++
vehTrunk[result][vehTrunkCounter[result]] = gunID
vehTrunkAmmo[result][vehTrunkCounter[result]] = gunAmmo
format(buffer, sizeof(buffer), "[CARMOD] You put your %s (AMMO: %i) in the car's trunk.", gunname, gunAmmo)
SendClientMessage(playerid, 0xFF0000FF, buffer)
// This adds back your guns EXCEPT for the one stored.
ResetPlayerWeapons(playerid)
for(new slot = 0; slot != 12; slot++)
{
GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot])
}
}else{
SendClientMessage(playerid, 0xFF0000FF, "[CARMOD] You can't store your hands in the car!")
}
}else{
SendClientMessage(playerid, 0xFF0000FF, "[CARMOD] You couldn't open the trunk.")
}
}else{
SendClientMessage(playerid, 0xFF0000FF, "[CARMOD] This car's trunk is full.")
}
}
default:
{
SendClientMessage(playerid, 0xFF0000FF, "[CARMOD] More than one car detected detected in the vercinity.")
}
}
return 1
}
wath`s the problem
Re: help with store weapons -
Zipper - 18.09.2008
Indent the code, I can't understand a single thing you're trying to do.
Re: help with store weapons -
Jaztek_Hodzic - 01.04.2009
you either unlock the car or stand at the trunk,
thats what happened to me
Re: help with store weapons -
Burridge - 01.04.2009
when you compiled, did it give any errors/warnings?
EDIT: :O sorry, dident relise the fool, above me had bumped a really old topic, i am sorry!