Help with resetplayerweapon
#1

Can someone told me what line to write for getting player weapons back after /exit from anywhere. When I enter in the paintball arena I have two weapons from there but when I exit my own weapon is gone !
Reply
#2

Try this code: ResetPlayerWeapons();
Reply
#3

https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
https://sampwiki.blast.hk/wiki/GivePlayerWeapon
Reply
#4

Make something like this before you have the ResetPlayerWeapons function
pawn Код:
new pWeapons[13];//idk how many weapons there are
new pAmmo[13];
for(new i=0; i < 13; i++)
{
GetPlayerWeaponData(playerid,i,pWeapons[i],pAmmo[i]);
}
Then when the player exits the paintball area, do this
pawn Код:
for(new i=0; i < 13; i++)
{
GivePlayerWeapon(playerid,pWeapon[i],pAmmo[i]);
}
This is just a global idea, I have no idea if it works when you exactly copy/paste it.
My intention with the above code is not for you to copy/paste it, but to understand what I do, so you can do it yourself.
Reply
#5

That is my FS and look at the line where is /exitpb:

// --------------------------------
// Simple Paintball Script created by DooM
// --------------------------------
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT

/* --Add these lines in your GM if you want to see the icon and text label
CreatePickup(1314, 1, 1310.3346,-1367.9858,13.5434,0); // Paintball Icon
Create3DTextLabel("Paintball \n Use /enterpb to join!",COLOR_DBLUE, 1310.3346,-1367.9858,13.5434, 20, 0,1); // text label
*/

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" [FS]RC Battlefield Paintball by DooM ");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" [FS]RC Battlefield Paintball by DooM ");
print("----------------------------------\n");

}

#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enterpb", cmdtext, true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 10.0, 1310.1757, -1367.2603, 13.5262)) return SendClientMessage(playerid,0xAA3333AA,"You are not at Paintball");
{
SetPlayerPos(playerid,-972.4957,1060.9830,1345.6690); // RC Battlefield Arena cords
SetPlayerInterior(playerid,10);
GivePlayerWeapon(playerid,24,99999); // DEAGLE
GivePlayerWeapon(playerid,27,99999); // SPAS12
SendClientMessage(playerid,0x2641FEAA,"You have joined paintball");
}
return 1;
}
if (strcmp("/exitpb", cmdtext, true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 1000.0,-972.4957,1060.9830,1345.6690)) return SendClientMessage(playerid,0xAA3333AA,"You are not in Paintball Arena");
{
SetPlayerPos(playerid, 1310.1757, -1367.2603, 13.5262);
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid, 1);
SendClientMessage(playerid,0xFF6347AA,"You have left paintball");
}
return 1;
}
return 0;
}
Reply
#6

I changed something in the commands, try these:
pawn Код:
new pWeapons[13];//idk how many weapons there are
new pAmmo[13];

if (strcmp("/enterpb", cmdtext, true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 10.0, 1310.1757, -1367.2603, 13.5262)) return SendClientMessage(playerid,0xAA3333AA,"You are not at Paintball");
{
for(new i=0; i < 13; i++)
{
GetPlayerWeaponData(playerid,i,pWeapons[i],pAmmo[i]);
}
ResetPlayerWeapons(playerid);
SetPlayerPos(playerid,-972.4957,1060.9830,1345.6690); // RC Battlefield Arena cords
SetPlayerInterior(playerid,10);
GivePlayerWeapon(playerid,24,99999); // DEAGLE
GivePlayerWeapon(playerid,27,99999); // SPAS12
SendClientMessage(playerid,0x2641FEAA,"You have joined paintball");
}
return 1;
}

if (strcmp("/exitpb", cmdtext, true) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 1000.0,-972.4957,1060.9830,1345.6690)) return SendClientMessage(playerid,0xAA3333AA,"You are not in Paintball Arena");
{
SetPlayerPos(playerid, 1310.1757, -1367.2603, 13.5262);
SetPlayerInterior(playerid, 0);
ResetPlayerWeapons(playerid, 1);
for(new i=0; i < 13; i++)
{
GivePlayerWeapon(playerid,pWeapon[i],pAmmo[i]);
}
SendClientMessage(playerid,0xFF6347AA,"You have left paintball");
}
return 1;
}
I just used the code I wrote in my first post, and placed it at the right place.
I hope it works
Reply
#7

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (4) : error 010: invalid function or declaration

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (6) : error 010: invalid function or declaration

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (eight) : error 010: invalid function or declaration

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (11) : error 054: unmatched closing brace ("}")

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (13) : error 010: invalid function or declaration

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (13) : error 010: invalid function or declaration

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (13 -- 15) : error 010: invalid function or declaration

D:\Downloads\Desktop\Roleplay\filterscripts\pb.pwn (13 -- 15) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply
#8

Show the code
Reply
#9

http://pastebin.com/MKsMWGY7
And if you can help me you'll the best because I really need that FS
Reply
#10

http://pastebin.com/8UAeU43w

I have edited the code with pastebin now, this should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)