SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/09/2019, 05:30 PM   #1
Blake95
Little Clucker
 
Join Date: Nov 2016
Posts: 27
Reputation: 2
Default Trunk Weapon Problem

Hi all!

I have a problem.. I Place the weapon to trunk and the SERVER IS STOPPED.

Code:
this::AddWeaponToTrunk(playerid, vehicleid, slot, weapon, ammo)
{
    vehicle_trunk_data[vehicleid][slot][data_id] = cache_insert_id();
    vehicle_trunk_data[vehicleid][slot][veh_wep] = weapon;
    vehicle_trunk_data[vehicleid][slot][veh_ammo] = ammo;
    vehicle_trunk_data[vehicleid][slot][is_exist] = true;
    vehicle_trunk_data[vehicleid][slot][veh_id] = VehicleInfo[vehicleid][eVehicleDBID];

	for(new i = 0; i < 6; i++) vehicle_trunk_data[vehicleid][slot][wep_offset][i] = 0.0;

	new Float: player_pos[3];
	GetPlayerPos(playerid, player_pos[0], player_pos[1], player_pos[2]);
    PlayerInfo[playerid][pEditingObject] = 3;
    SetPVarInt(playerid, "getVehicleID", vehicleid);
    SetPVarInt(playerid, "getSlot", slot);

    vehicle_trunk_data[vehicleid][slot][temp_object] = CreateDynamicObject(ReturnWeaponsModel(weapon), player_pos[0], player_pos[1], player_pos[2], 0, 0, 0);
	EditDynamicObject(playerid, vehicle_trunk_data[vehicleid][slot][temp_object]);
    SendClientMessage(playerid, COLOR_LIGHTRED, "[ ! ]{FFFFFF} Tarthatod {FFFF00}W{FFFFFF} a szerkesztés közbeni mozgatásához.");

	PlayerInfo[playerid][pWeaponsAmmo][ ReturnWeaponIDSlot(weapon) ] = 0;
	PlayerInfo[playerid][pWeapons][ ReturnWeaponIDSlot(weapon) ] = 0;
	RemovePlayerWeapon(playerid, weapon);

    sendMessage(playerid, -1, "{FFFF00} Tároltál egy %s-t. Jármű: %s.", ReturnWeaponName(weapon), ReturnVehicleName(vehicleid));
	return 1;
}
What's wrong?
Thank you.
Blake95 is offline   Reply With Quote
Old 22/09/2019, 06:38 PM   #2
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 2,528
Reputation: 556
Default Re: Trunk Weapon Problem

Show me ReturnWeaponIDSlot, it might return some value out of PlayerInfo[playerid][pWeaponsAmmo] or PlayerInfo[playerid][pWeapons] bounds.
Misiur is offline   Reply With Quote
Old 22/09/2019, 06:48 PM   #3
Blake95
Little Clucker
 
Join Date: Nov 2016
Posts: 27
Reputation: 2
Default Re: Trunk Weapon Problem

stock ReturnWeaponIDSlot(weaponid)
{
new returnID;

switch(weaponid)
{
case 1 .. 10: returnID = 0;
case 11 .. 18, 41, 43: returnID = 1;
case 22 .. 24: returnID = 2;
case 25, 27 .. 34: returnID = 3;
}
return returnID;
}
Blake95 is offline   Reply With Quote
Old 30/09/2019, 03:46 PM   #4
Blake95
Little Clucker
 
Join Date: Nov 2016
Posts: 27
Reputation: 2
Default Re: Trunk Weapon Problem

bump.
Blake95 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weapon Object in the car trunk CoachCarter Scripting Help 0 01/08/2015 08:19 AM
placing the right selected weapon from GetPlayerWeaponData into the car trunk at ondialogresponse Apenmeeuw Scripting Help 1 28/02/2013 10:42 AM
How to place a weapon in trunk? Outcast Scripting Help 3 09/01/2012 12:47 PM


All times are GMT. The time now is 06:27 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.