Freezing problem - 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: Freezing problem (
/showthread.php?tid=96806)
Freezing problem -
Ov3rl0rd - 11.09.2009
Wow this post + my last one make me seem like a noob >.<
Anyway this post is about a timer etc. I made that doesn't want to work. The point of it is to check a players position every second, and if they are near a trap that has been laid by the other team, than they are frozen but, this is not working. Here is the code
Код:
forward MagTimer(playerid);
public MagTimer(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Xmag[i] != 255 && Ymag[i] != 255 && Zmag[i] != 255 && PlayerToPoint(2.0,i,Xmag[i],Ymag[i],Zmag[i]))
{
if (gTeam[playerid] == TEAM_SEAK)
{
TogglePlayerControllable(playerid,0);
Xmag[i] = 255;
Ymag[i] = 255;
Zmag[i] = 255;
return 1;
}
}
}
return 0;
}
public OnPlayerSpawn(playerid)
{
if (gTeam[playerid] == TEAM_SEAK)
{
SetTimer("MagTimer",1000,1);
SetPlayerToTeamColor(playerid);
return 1;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new Float:x, Float:y, Float:z;
if(strcmp(cmdtext,"/trap",true) ==0)
{
if (gTeam[playerid] == TEAM_SNEAK)
{
if(Mag[playerid] == 0)
{
Mag[playerid] = 1;
GetPlayerPos(playerid,x,y,z);
Xmag[playerid] = x;
Ymag[playerid] = y;
Zmag[playerid] = z;
SetPlayerMapIcon(playerid,1,x,y,z,61,COLOR_YELLOW);
ApplyAnimation(playerid,"BOMBER","BOM_Plant",1,0,0,0,0,2000);
CreateObject(2824,x,y,18.7,0,0,0);
SendClientMessage(playerid,COLOR_BLUE,"You have placed a magazine. It will distract anyone that walks by it. You have 1 mag remaining!");
return 1;
}
Blah blah
Re: Freezing problem -
Ov3rl0rd - 11.09.2009
Hmmm it still doesn't work right :/
Re: Freezing problem -
Gappy - 11.09.2009
Try
pawn Код:
SetTimerEx("MagTimer",1000,1,"i",playerid);
Re: Freezing problem -
Ov3rl0rd - 11.09.2009
No its weird cause it worked earlier but ofc I changed something and it fucked up the Mag shit and I didn't pay attention to it and now here I am lol. The SetTimerEx still didn't work. Im thinking it has something to do with retrieving the coords of the placed trap.
Edit: Ok its doing what it did about 30 minutes ago. When I spawn, my player randomly freezes every second for a second as if he was in a trap even though he isn't >.<
Re: Freezing problem -
Clavius - 11.09.2009
Try replacing
pawn Код:
if(Xmag[i] != 255 && Ymag[i] != 255 && Zmag[i] != 255 && PlayerToPoint(2.0,i,Xmag[i],Ymag[i],Zmag[i]))
with
pawn Код:
if(Xmag[i] != 255 && Ymag[i] != 255 && Zmag[i] != 255 && PlayerToPoint(2.0,playerid,Xmag[i],Ymag[i],Zmag[i]))
Re: Freezing problem -
Ov3rl0rd - 11.09.2009
Quote:
Originally Posted by player007
Try replacing
pawn Код:
if(Xmag[i] != 255 && Ymag[i] != 255 && Zmag[i] != 255 && PlayerToPoint(2.0,i,Xmag[i],Ymag[i],Zmag[i]))
with
pawn Код:
if(Xmag[i] != 255 && Ymag[i] != 255 && Zmag[i] != 255 && PlayerToPoint(2.0,playerid,Xmag[i],Ymag[i],Zmag[i]))
|
Dude your awesome. I works for the most part, just a few small bugs I have to fix but thanks you did the hard part