2 Easy questions. - 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: 2 Easy questions. (
/showthread.php?tid=58999)
2 Easy questions. -
Mrkrabz - 23.12.2008
Hey, What i want is, When the player enters the area, It in gamemodetext says "Safe Zone" When he leaves it Says Left Safe Zone, Also, when you are in the safezone, You are godded, When you leave, Your health goes back to default.
Here is what i have.
pawn Код:
// Above OnGameModeInit:
new safezone;
// OnGameModeInit
safezone = GangZoneCreate(1319.6, -2755.979, 2207.118, -2125.373);
// Player Spawn
GangZoneShowForPlayer(playerid, safezone, 0xFF00007E);
ALSO, How can i make a command bind to a key, Like /lockall is binded to 9 and /unlockall is binded to 0
(NOT NUMPAD)
Re: Gang zone. -
LarzI - 23.12.2008
Use IsPlayerInArea, and look in Useful Commands for /god
Re: 2 Easy questions. -
Mrkrabz - 23.12.2008
i allready know god, But yeah, thanks ill have a go.
Re: 2 Easy questions. -
LarzI - 23.12.2008
np
Re: 2 Easy questions. -
Mrkrabz - 23.12.2008
Ok, i am forgetting the God for now, But i have done this.
IsPlayerInArea(playerid, 1319.6, -2755.979, 2207.118, -2125.373);
SetplayerHealth(playerid, 10000.00);
Where does that go, I put in Playerspawn, But it says unidentified Symbol IsPlayerInArea And Same again for SetPlayerHealth
Help! xD, Thanks.
Re: 2 Easy questions. -
LarzI - 23.12.2008
Over main()
pawn Код:
new SafeZoneTimer;
new hasBeenInSafeZone[MAX_PLAYERS];
forward SafeZone();
OnGameModeInit()
pawn Код:
SafeZoneTimer = SetTimer("SafeZone", 200, true);
OnGameModeExit()
pawn Код:
KillTimer(SafeZoneTimer);
Anywhere in script
pawn Код:
public SafeZone()
{
for(new i=0, m=MAX_PLAYERS; i<m; i++)
{
if(IsPlayerInArea(i, 1319.6, -2755.979, 2207.118, -2125.373) && !hasBeenInSafeZone[i])
{
GameTextForPlayer(i, "~g~Safe Zone", 2000, 5);
//Add timer for god here
hasBeenInSafeZone[i] = 1;
}
else if(hasBeenInSafeZone[i])
{
GameTextForPlayer(i, "~r~Left Safe Zone", 2000, 5);
//Kill godtimer
hasBeenInSafeZone[i] = 0;
}
}
return true;
}
Not tested, but should work
Re: 2 Easy questions. -
Mrkrabz - 23.12.2008
Thanks Man.
Scorp.
EDIT: error 017: undefined symbol "IsPlayerInArea"
Re: 2 Easy questions. -
LarzI - 23.12.2008
np
Re: 2 Easy questions. -
Mrkrabz - 23.12.2008
Read my last post
Quote:
Originally Posted by scorp1543
Thanks Man.
Scorp.
EDIT: error 017: undefined symbol "IsPlayerInArea"
|
Re: 2 Easy questions. -
LarzI - 23.12.2008
pawn Код:
stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return true;
return false;
}