how to check if the player moved? -
drichie - 05.07.2013
how to check if the player moved or not in the point? and where do i put that code in this?....
pawn Код:
CMD:rob(playerid,params[])
{
for(new i=0; i<MAX_PICK; i++)
{
if(IsPlayerInRangeOfPoint(playerid,2,PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]) && GetPlayerVirtualWorld(playerid) == PickInfo[i][pVw] && GetPlayerInterior(playerid) == PickInfo[i][pInt])
{
ApplyAnimation(playerid, "ROB_BANK", "CAT_SAFE_ROB", 4.0, 1, 0, 0,0, 1);
rt = SetTimer("robtimer",1000,true);
return 1;
}
}
return 1;
}
forward robtimer(playerid);
public robtimer(playerid)
{
CountDownVar--;
new str[128];
format(str, sizeof(str), "Count Down: %d",CountDownVar);
GameTextForPlayer(playerid,str,1000,6);
for(new i=0; i<MAX_PICK; i++)
{
if(CountDownVar == 0)
{
new rand = random(999);
GiveDrichMoney(playerid,rand);
format(str,128," %s has robbed %i",GetName(playerid),rand);
SCM(playerid,-1,str);
ClearAnimations(playerid);
KillTimer(rt);
CountDownVar = 15;
return 1;
}
}
return 1;
}
Re: how to check if the player moved? -
Sasino97 - 05.07.2013
Check again with "IsPlayerInRangeOfPoint" at the starting of robtimer
EDIT:
Anyway, change
Код:
rt = SetTimer("robtimer",1000,true);
to
Код:
rt[playerid] = SetTimerEx("robtimer",1000,true, "i", playerid);
Otherwise it will work only with player id 0.
Re: how to check if the player moved? -
drichie - 05.07.2013
ow thanks mr sasino for the correction,, i want if the player type /rob where there is no created point it will send your not in a rob point and if he type /rob in the created point whiled the timer runs he moved the timer will cancel and send client message robbery failed... ive tried few ways but after checkin again isplayerrangeofpoint the only point that is recognized is the one that 1st i created
Full code -
Sasino97 - 05.07.2013
Try this:
pawn Код:
CMD:rob(playerid,params[])
{
for(new i=0; i<MAX_PICK; i++)
{
if(IsPlayerInRangeOfPoint(playerid,2,PickInfo[i][pX], PickInfo[i][pY], PickInfo[i][pZ]) && GetPlayerVirtualWorld(playerid) == PickInfo[i][pVw] && GetPlayerInterior(playerid) == PickInfo[i][pInt])
{
ApplyAnimation(playerid, "ROB_BANK", "CAT_SAFE_ROB", 4.0, 1, 0, 0,0, 1);
rt[playerid] = SetTimerEx("robtimer", 1000, true, "i", playerid);
SetPVarFloat(playerid, "robX", PickInfo[i][pX]);
SetPVarFloat(playerid, "robY", PickInfo[i][pY]);
SetPVarFloat(playerid, "robZ", PickInfo[i][pZ]);
return 1;
}
}
return 1;
}
forward robtimer(playerid);
public robtimer(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, GetPVarFloat(playerid, "robX"), GetPVarFloat(playerid, "robY"), GetPVarFloat(playerid, "robZ"))
{
CountDownVar--;
new str[128];
format(str, sizeof(str), "Count Down: %d",CountDownVar);
GameTextForPlayer(playerid,str,1000,6);
for(new i=0; i<MAX_PICK; i++)
{
if(CountDownVar == 0)
{
new rand = random(999);
GiveDrichMoney(playerid,rand);
format(str,128," %s has robbed %i",GetName(playerid),rand);
SCM(playerid,-1,str);
ClearAnimations(playerid);
KillTimer(rt);
CountDownVar = 15;
return 1;
}
}
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "Robbery Failed");
KillTimer(rt[playerid]);
}
return 1;
}
Re: how to check if the player moved? -
drichie - 05.07.2013
so thats the trick there changing variables!! imma try this and comment if it works or not tnx again mr sasino.
Re: how to check if the player moved? -
Sasino97 - 05.07.2013
You're welcome

but I'm not a mr xD, call me just Sasino
Re: how to check if the player moved? -
drichie - 05.07.2013
WOW it works im making a dynamic rob point and i have this problem for three days and i cant resolve it.....ive posted already 2 help request here + this tnx you so much btw my next plan is to make house system with furniture system and a biz system base on your Sasinosoft Houses 2 - House + Store + Furniture System...