16.01.2017, 11:32
Good Morning,
I'm getting so annoyed with all my attempts to fix this command with failure ..
This Command is used to give someone your gun, but it give him the gun with 60000 ammo that means infinite ammo !
So, What I wanted to do is to make the player give his weapon with it's ammo on it.
I've already fixed so many commands and functions in my script so as to have ammo that is counted instead of infinity such as the Ammunation System and the Arms Dealer Job...
But I want to create a GetPlayerWeaponData so I can know the ammo of the player using the command so as to be used into the GivePlayerWeapon(x,x,ammo)
I tried a lot this whole night in vain !!
I created a variable :
Then I made a loop to get the infos about slots and ammos
But I couldn't figure out how to make it work with my command, every time I try, I just mess up :/
So, please Can you tell me the right method or can you add it for me to the example below, I would be very Thankful!!
Thanks in Advance !!
I'm getting so annoyed with all my attempts to fix this command with failure ..
This Command is used to give someone your gun, but it give him the gun with 60000 ammo that means infinite ammo !
So, What I wanted to do is to make the player give his weapon with it's ammo on it.
I've already fixed so many commands and functions in my script so as to have ammo that is counted instead of infinity such as the Ammunation System and the Arms Dealer Job...
But I want to create a GetPlayerWeaponData so I can know the ammo of the player using the command so as to be used into the GivePlayerWeapon(x,x,ammo)
I tried a lot this whole night in vain !!
I created a variable :
Код:
new weapons[13][2];
Код:
for (new i = 0; i <= 12; i++) { GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]); }
So, please Can you tell me the right method or can you add it for me to the example below, I would be very Thankful!!
Код:
CMD:giveweapon(playerid, params[]) { if(GetPVarInt(playerid, "Injured") != 0||PlayerCuffed[playerid]!=0||GetPVarInt(playerid, "Hospital")!=0||GetPlayerState(playerid) == 7) { SendClientMessageEx (playerid, COLOR_GRAD2, "You cannot do this at this time."); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessageEx (playerid, COLOR_GRAD2, "You can not give weapons in a vehicle!"); return 1; } if (GetPVarInt(playerid, "GiveWeaponTimer") > 0) { new string[58]; format(string, sizeof(string), "You must wait %d seconds before giving another weapon.", GetPVarInt(playerid, "GiveWeaponTimer")); SendClientMessageEx(playerid,COLOR_GREY,string); return 1; } new string[128], giveplayerid, weapon[64]; if(sscanf(params, "us[64]", giveplayerid, weapon)) { SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giveweapon [playerid] [weapon name]"); SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: sdpistol, shotgun, 9mm, mp5, uzi, tec9, rifle, deagle, ak47, m4, spas12, sniper"); SendClientMessageEx(playerid, COLOR_GRAD2, "Available Names: flowers, knuckles, baseballbat, cane, shovel, poolcue, golfclub, katana, dildo, parachute"); return 1; } if(IsPlayerInAnyVehicle(giveplayerid)) { SendClientMessageEx (playerid, COLOR_GRAD2, "You can not give weapons to players in vehicles!"); return 1; } if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GRAD1, "You can not give a weapon to yourself!"); return 1; } if(!ProxDetectorS(3.0, playerid, giveplayerid)) { SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you."); return 1; } if(PlayerInfo[playerid][pMember] != PlayerInfo[giveplayerid][pMember] && PlayerInfo[playerid][pMember] > 0) { SendClientMessageEx(playerid, COLOR_GRAD1, "You can not give weapons to players outside your faction!"); return 1; } if(IsPlayerConnected(giveplayerid)) { if(IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "Please exit the vehicle, before using this command."); if(strcmp(weapon, "sdpistol", true) == 0) { if(PlayerInfo[playerid][pGuns][ 2 ] == 23) { if(PlayerInfo[giveplayerid][pGuns][ 2 ] != 23 && PlayerInfo[giveplayerid][pGuns][ 2 ] != 24) { SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "You have given away your silenced pistol."); format(string, sizeof(string), "* %s has given %s their silenced pistol.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); RemovePlayerWeapon(playerid, 23); GivePlayerValidWeapon(giveplayerid, 23, 60000); new ip[32], ipex[32]; GetPlayerIp(playerid, ip, sizeof(ip)); GetPlayerIp(giveplayerid, ipex, sizeof(ipex)); GetPlayerIp(giveplayerid, ipex, sizeof(ipex));format(string, sizeof(string), "%s (IP:%s) has given %s(IP:%s) has given %s (IP:%s) their silenced pistol.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(giveplayerid), ipex); Log("logs/pay.log", string); }