Hello, before to strat I just want to say : I'm not english so sorry if my english is not perfect.
I have a little problem on my server SA:MP. I have a script to drop a weapon, but when a player is Unsync (with the server), he can drop weapon to infinity (the unsync player keep the weapon in his hand but the weapon is dropped too ).
So, I want to make a security, if the player is unsync, and he drop his weapon AND he keep the weapon in this hand, i want to delete the weapon (in this hand OR on the floor)
This is my code
I have a little problem on my server SA:MP. I have a script to drop a weapon, but when a player is Unsync (with the server), he can drop weapon to infinity (the unsync player keep the weapon in his hand but the weapon is dropped too ).
So, I want to make a security, if the player is unsync, and he drop his weapon AND he keep the weapon in this hand, i want to delete the weapon (in this hand OR on the floor)
This is my code
Code:
if(strcmp(subcmd, "weapon", true) == 0)
{
if(GetPlayerWeapon(playerid) == 0)
{SendClientMessage(playerid, COLOR_PINK, "[Info] You want to have your weapon in your hand."); return 1;}
if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pMember] == 20)
{
if(OnDuty[playerid]){SendClientMessage(playerid, COLOR_PINK, "[Info]You can't do that now."); return 1;}
}
new indice = -1;
new wepId = GetPlayerWeapon(playerid);
new ammo = GetPlayerAmmo(playerid);
print("Lancement Boucle 57");
for(i=0; i<drop_weapondsDropableCount; i++)
{
if(wepId ==drop_weapondsDropableId[i])
{indice = i; break;}
}
print("Fin Boucle 57");
if(indice >= 0)
{
new f = MAX_GUNDROP+1;
for(new a = 0; a < MAX_GUNDROP; a++)
{
if(dGunData[a][ObjPos][0] ==0.0)
{
f = a;
break;
}
}
if(f > MAX_GUNDROP) returnSendClientMessage(playerid, -1, "You can't do that now.");
RemovePlayerWeapon(playerid, wepId);
dGunData[f][ObjData][0] = wepId;
dGunData[f][ObjData][1] = ammo;
GetPlayerPos(playerid, dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]);
dGunData[f][ObjID] =CreateObject(GunObjects[wepId], dGunData[f][ObjPos][0], dGunData[f][ObjPos][1], dGunData[f][ObjPos][2]-1, 93.7, 120.0, 120.0);
new buffer[50];
format(buffer, sizeof(buffer), "you dropped your %s on the floor.", GunNames[dGunData[f][ObjData][0]]);
SendClientMessage(playerid, -1, buffer);
format(proxy_msg, sizeof(proxy_msg), "%s drop a weapon on the floor.", playername);
proxy_teteMsg(playerid, proxy_msg);
}
else
{SendClientMessage(playerid, COLOR_PINK, "[Info] Impossible now."); return 1;}
return 1;
}
}