25.12.2010, 04:25
I have a problem. I have this script:
(Note: IsPlayerInGangzoneCheckpoint returns a gangzone ID, which isn't the "real" ID of it. The real ID of it is in GangzoneRealID array)
And, I also add a the function already (public and already forwarded):
But it doesn't run! I tried removing the "return" stuff from the function and it still doesn't work!
Can anyone help please?
pawn Code:
GangZoneFlashForAll(GangzoneRealID[IsPlayerInGangzoneCheckpoint(playerid)], GetPlayerColor(playerid));
new gztimer
gztimer = SetTimerEx("takeover", 1000, true, "ii", playerid, IsPlayerInGangzoneCheckpoint(playerid))
SetPVarInt(playerid, "gztimer", gztimer);
And, I also add a the function already (public and already forwarded):
pawn Code:
public takeover(playerid, gangzoneid)
{
new string[256];
GangzoneChangeTimer[gangzoneid] += 1;
if(GangzoneChangeTimer[gangzoneid] == 60)
{
if(GetGangzoneOwner(gangzoneid) >= 0)
{
format(string, sizeof(string), "|- {FFFF00}%s {00FF00}has successfully taken over the territory of {FFFF00}%s {00FF00} -|", PlayerName(playerid), GetTeamName(GetGangzoneOwner(gangzoneid)));
SendClientMessageToAll(0x00FF00AA, string);
}
else
{
format(string, sizeof(string), "|- {FFFF00}%s {00FF00}has successfully taken over the territory -|", PlayerName(playerid));
SendClientMessageToAll(0x00FF00AA, string);
}
new savefile[125];
format(savefile, sizeof(savefile), "/territory/%i.ter", gangzoneid);
dini_IntSet(savefile, "owner", GetPlayerTeam(playerid));
GangzoneOwner[gangzoneid] = GetPlayerTeam(playerid);
GangzoneChangeOwner[gangzoneid] = -1;
GangZoneHideForAll(GangzoneRealID[gangzoneid]);
GangZoneShowForAll(GangzoneRealID[gangzoneid], GetPlayerColor(playerid));
GangzoneColor[gangzoneid] = GetPlayerColor(playerid);
KillTimer(GetPVarInt(playerid, "gztimer"));
}
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 30, GangzoneCheckpoint[gangzoneid][0], y, GangzoneCheckpoint[gangzoneid][2]))
{
if(!IsPlayerInRangeOfPoint(playerid, 15, GangzoneCheckpoint[gangzoneid][0], y, GangzoneCheckpoint[gangzoneid][2]))
{
GameTextForPlayer(playerid, "~w~Watch out! ~r~You're too far from the ~y~checkpoint!~n~~w~Go back to the checkpoint!", 2000, 3);
}
}
else
{
GameTextForPlayer(playerid, "~r~You have failed on trying to ~y~takeover~r~ this territory", 4000, 3);
format(string, sizeof(string), "|- {FFFF00}%s {FF0000}has failed to take over the territory -|", PlayerName(playerid));
SendClientMessageToAll(0xFFFF00AA, string);
KillTimer(GetPVarInt(playerid, "gztimer"));
}
new mes[10];
format(mes, sizeof(mes), "~w~%i", 60 - GangzoneChangeTimer[gangzoneid]);
GameTextForPlayer(playerid, mes, 1001, 3);
}
return print("Timer run"); //This is a debug.
}
Can anyone help please?