Help with Boxing
#1

Well i dont know how to get back weapons when someone writes /exit
heres the code
Код:
#include <a_samp>
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
UsePlayerPedAnims();
    
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{

 }
#endif

public OnGameModeInit()
{
UsePlayerPedAnims();

}
public OnPlayerCommandText(playerid,cmdtext[])
{
    if( !strcmp(cmdtext,"/box",true ))
    {
    SetPlayerPos(playerid, 2058.125000, 2434.458008, 166.983597);
    ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid,0,0);
    SetPlayerArmour(playerid,0);
    SetPlayerHealth(playerid,100);
    
		return 1;
          }

    else if (strcmp(cmdtext, "/exit", true)==0)
    {
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid,2466.930664, -1660.438720, 13.277129);

    return 1;
  }
    return 0;
}
plz someone help
Reply
#2

Get the players, save them in variables, return them when you want.
Reply
#3

example: at the top: new IsBoxing[MAX_PLAYERS],SavedBoxWeapons[MAX_PLAYERS][13];
Then in the start variable IsBoxing[playerid]=1;
and save here the weapons with a for(new i=0; i<13; i++)
Then in the Exit: variable IsBoxing[playerid]=0;
Reply
#4

Код:
#include <a_samp>
#if defined FILTERSCRIPT
new Guns[200][2][13];

public OnFilterScriptInit()
{
	UsePlayerPedAnims();
 	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{

 }
#endif

public OnGameModeInit()
{
UsePlayerPedAnims();

}
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/box",true ))
    {
    for(new x = 0; x < 13; x++) GetPlayerWeaponData(playerid, x, Guns[playerid][0][x], Guns[playerid][1][x]);
    SetPlayerPos(playerid, 2058.125000, 2434.458008, 166.983597);
    SetPlayerArmour(playerid,0);
    SetPlayerHealth(playerid,100);
    ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid,0,0);
		return 1;
		}

		if!(strcmp(cmdtext, "/exit", true))
    {
    ResetPlayerWeapons(playerid);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid,2466.930664, -1660.438720, 13.277129);
    for(new x = 0; x < 13; x++) GivePlayerWeapon(playerid, Guns[playerid][0][x], Guns[playerid][1][x]);
    return 1;
  	}
    return 0;
}
Reply
#5

Код:
#include <a_samp>
new Guns[200][2][13];
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	UsePlayerPedAnims();
 	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{

 }
#endif

public OnGameModeInit()
{
UsePlayerPedAnims();

}
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/box",true ))
    {
    for(new x = 0; x < 13; x++) GetPlayerWeaponData(playerid, x, Guns[playerid][0][x], Guns[playerid][1][x]);
    SetPlayerPos(playerid, 2058.125000, 2434.458008, 166.983597);
    SetPlayerArmour(playerid,0);
    SetPlayerHealth(playerid,100);
    ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid,0,0);
		return 1;
		}

		if!(strcmp(cmdtext, "/exit", true))
    {
    ResetPlayerWeapons(playerid);
    SetPlayerInterior(playerid, 0);
    SetPlayerPos(playerid,2466.930664, -1660.438720, 13.277129);
    for(new x = 0; x < 13; x++) GivePlayerWeapon(playerid, Guns[playerid][0][x], Guns[playerid][1][x]);
    return 1;
  	}
    return 0;
}
Reply
#6

thanx but still

Код:
D:\tik GTA SA\box\Box.pwn(43) : error 028: invalid subscript (not an array or too many subscripts): "strcmp"
D:\tik GTA SA\box\Box.pwn(50) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#7

ops
if!(strcmp(cmdtext, "/exit", true))

Код:
if(!strcmp(cmdtext, "/exit", true))
And sory for double ;x lag
Reply
#8

fixed and got this

Код:
D:\tik GTA SA\box\Box.pwn(32) : error 028: invalid subscript (not an array or too many subscripts): "strcmp"
D:\tik GTA SA\box\Box.pwn(33) : error 001: expected token: "}", but found "for"
D:\tik GTA SA\box\Box.pwn(42) : error 010: invalid function or declaration
D:\tik GTA SA\box\Box.pwn(47) : error 010: invalid function or declaration
D:\tik GTA SA\box\Box.pwn(48) : error 010: invalid function or declaration
D:\tik GTA SA\box\Box.pwn(50) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#9

help plz ?
Reply
#10

i copied the code you posted, corrected what jeff said, and it compiles great.....
Reply
#11

then wth ....

**Edit**
lol it works now thanx for everyone =D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)