SA-MP Forums Archive
Help with Boxing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with Boxing (/showthread.php?tid=66678)



Help with Boxing - andriuz - 23.02.2009

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


Re: Help with Boxing - Rks25 - 23.02.2009

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


Re: Help with Boxing - harrold - 23.02.2009

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;


Re: Help with Boxing - Jefff - 23.02.2009

Код:
#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;
}



Re: Help with Boxing - Jefff - 23.02.2009

Код:
#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;
}



Re: Help with Boxing - andriuz - 23.02.2009

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.



Re: Help with Boxing - Jefff - 23.02.2009

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

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


Re: Help with Boxing - andriuz - 24.02.2009

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.



Re: Help with Boxing - andriuz - 02.03.2009

help plz ?


Re: Help with Boxing - Rks25 - 02.03.2009

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


Re: Help with Boxing - andriuz - 02.03.2009

then wth ....

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