/Dropweapon Command
#1

Hello guys im having some trouble to make this kind of command used for RP servers
I trieda lot of times with any succes :/ Can someone make me one? i know its real simple but every time i try to make one i fuck up the script xD
Reply
#2

What you want to do exactly?
If i understand you good, then..

Код:
new Gun[MAX_PLAYERS];
Код:
COMMAND:dropweapon(playerid,params[])
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=0;i<MAX_PLAYERS;i++){ Gun[i] = CreatePickup(349,4,x,y,z,-1); }
return 1;
}
Код:
OnPlayerPickupPickup(playerid,pickupid)
{
if(pickupid == Gun[playerid])
{
// GivePlayerGun
return 1;
}
return 1;
}
It's for example. I don't write you fully script.
Reply
#3

I Dont want Any pickup i just want to make a /dropweapon command that Resets your weapons you got and send you a client message in purple like "Mark_Willow Has dropped his/her Weapon on the floor"
Something like that you should seen this in RP Servers
Reply
#4

To reset all weapons:

Код:
COMMAND:dropweapons(playerid,params[])
{
new name[MAX_PLAYER_NAME],msg[128],Float:x,Float:y,Float:z;
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
GetPlayerPos(playerid,x,y,z);
ResetPlayerWeapons(playerid);
format(msg,128,"%s has dropped his/her weapon on the floor.",name);
for(new i=0;i<MAX_PLAYERS;i++){
if(IsPlayerConnected(playerid)){
if(IsPlayerInRangeOfPoint(i,15,x,y,z)){
SendClientMessage(i,0xC2A2DAAA,msg);
}
}
}
return 1;
}
To weapon, which you hold.

Код:
COMMAND:dropweapon(playerid,params[])
{
if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid,0xFF0000FF,"You haven't gun in Your hand.");
new name[MAX_PLAYER_NAME],msg[128],Float:x,Float:y,Float:z;
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
GetPlayerPos(playerid,x,y,z);
new WhatGun = GetPlayerWeapon(playerid);
new HowMuch = GetPlayerAmmo(playerid);
GivePlayerWeapon(playerid,WhatGun,-HowMuch);
format(msg,128,"%s has dropped his/her weapon on the floor.",name);
for(new i=0;i<MAX_PLAYERS;i++){
if(IsPlayerConnected(playerid)){
if(IsPlayerInRangeOfPoint(i,15,x,y,z)){
SendClientMessage(i,0xC2A2DAAA,msg);
}
}
}
return 1;
}
Reply
#5

iDont know much of pawno im trying to understood the code you gave me :/ and i dont understand how it works and how i can add it on the GM :/
Reply
#6

Код:
if (strcmp("/dropgun", cmdtext, true, 10) == 0)
{
if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid,0xFF0000FF,"You haven't gun in Your hand.");
new name[MAX_PLAYER_NAME],msg[128],Float:x,Float:y,Float:z;
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
GetPlayerPos(playerid,x,y,z);
new WhatGun = GetPlayerWeapon(playerid);
new HowMuch = GetPlayerAmmo(playerid);
GivePlayerWeapon(playerid,WhatGun,-HowMuch);
format(msg,128,"%s has dropped his/her weapon on the floor.",name);
for(new i=0;i<MAX_PLAYERS;i++){
if(IsPlayerConnected(playerid)){
if(IsPlayerInRangeOfPoint(i,15,x,y,z)){
SendClientMessage(i,0xC2A2DAAA,msg);
}
}
}
return 1;
}
put that under
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
Reply
#7

Oh thanks i though i needed to put anywhere in the script thanks really appreciated it
Reply
#8

Quote:
Originally Posted by Platanito
Oh thanks i though i needed to put anywhere in the script thanks really appreciated it
Glad I could help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)