SA-MP Forums Archive
help with defines - 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)
+--- Thread: help with defines (/showthread.php?tid=387122)



help with defines - St1geR - 23.10.2012

hello, i creating my own server, and i have problem: this is script:
Код:
new bool:InDrag[MAX_PLAYERS];
new bool:InDm[MAX_PLAYERS];
new bool:InStunt[MAX_PLAYERS];
#define     IsAnywhere(%0)      \
				( InDrag [ %0 ], InStunt [ %0 ], InDm [ %0 ] )
and when i type /stunt also InStunt == 1 , thats is not problem.

problem is with dcmd_player:

Код:
dcmd_player(playerid, params[])
{
	#pragma unused params
	if ( !IsAnywhere ( playerid ) ) return SendClientMessage(playerid, RED, "you are not in zone.");
	if(IsPlayerInAnyVehicle(playerid))
	{
		RemovePlayerFromVehicle(playerid);
		SetPlayerVirtualWorld(playerid, 0);
		InDrag[playerid] = false;
		InDm[playerid] = false;
		InStunt[playerid] = false;
		TextDrawHideForPlayer(playerid, stunttd);
		TextDrawHideForPlayer(playerid, DMtd);
	    DisablePlayerRaceCheckpoint(playerid);
		SpawnPlayer(playerid);
	}
	else
	{
		SetPlayerVirtualWorld(playerid, 0);
		InDrag[playerid] = false;
	 	InDm[playerid] = false;
        InStunt[playerid] = false;
        TextDrawHideForPlayer(playerid, stunttd);
		TextDrawHideForPlayer(playerid, DMtd);
	    DisablePlayerRaceCheckpoint(playerid);
		SpawnPlayer(playerid);
	}
	return 1;
}
when i go in /stunt and type /player , server is writing "you are not in zone" but when i InDrag /player cmd is working.

before when there was no bool:InDm, then its ok, bet when i put in the gm InDm, then the problems started, plz help with this.


Re: help with defines - redreaper666 - 23.10.2012

why you just dont use SetPVarInt(playerid,"ART OF PLACE",1);
and using GetPVarInt instead of using bools
also it would be better to use PlayerVars cause of you could make like gamemode cmds that only can be used if they have like

COMMANDetcar(playerid, params[])
{
if(GetPVarInt(playerid, "STUNT") != 1) return SendClientMessage(playerid, -1, "You arent in the stunt area");
new amt;
DestroyVehicle(gPlayerVehicles[playerid]);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new Float:A, Float:B, Float:C;
GetPlayerPos(playerid, A,B,C);
PlayerPlaySound(playerid, 1139, A,B,C);
gPlayerVehicles[playerid] = CreateVehicle(amt, X, Y, Z,0,-1,-1,10);
PutPlayerInVehicle(playerid,gPlayerVehicles[playerid],0);
return 1;
}


Re: help with defines - St1geR - 23.10.2012

with bools convenient for me

how to use macro, explain and help fix this bug :/


Re: help with defines - St1geR - 23.10.2012

sory, my bad english

i dont know, this script my friend created..

edit: no one can help with this? though tell a another script for fix this problem

edit:

i found the problem in this :
Код:
#define     IsAnywhere(%0)      \
				( InDrag [ %0 ], InStunt [ %0 ], InDm [ %0 ] )
server writes i'm not in InStunt

when I change to :
Код:
				( InDrag [ %0 ], InDM [ %0 ], InStunt [ %0 ] )
then server write im not in dm, how to fix this problem?