Chase CMD, Updating of Marker -
firemanjv - 24.09.2013
Hello, I got a problem I want to let the marker move with the player..
this is my code
Код:
CMD:chase(playerid, params[])
{
new string[128], Float:bkx, Float:bky, Float:bkz;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO.");
GetPlayerPos(playerid, bkx, bky, bkz);
format(string, sizeof(string), "[Central Dispatch]: %s is in a 10-0, please repsond code:3 (With Lights & Sirens)", RPN(playerid));
SendCopMessage(COLOR_RADIO, string);
foreach(Player, i)
{
if(IsACop(i))
{
SetPlayerMapIcon(i, 99, bkx, bky, bkz, 0, COLOR_BLUE, 3);
}
}
return 1;
}
Re: Chase CMD, Updating of Marker - Patrick - 24.09.2013
Put a timer, so the MapIcon would update every second
Re: Chase CMD, Updating of Marker -
firemanjv - 25.09.2013
Uhm, could you help me abit with it? like a preview?
Re: Chase CMD, Updating of Marker -
JamesH - 25.09.2013
Alright follow this :
On the top of your script add
The following lines should be inserted into a TIMER if you want the checkpoint to update every moment use a short timer. LOOK BELOW :
pawn Код:
if(IsPlayerConnected(CopMarker) || CopMarker!= -1)
{
if(IsACop(i))
{
new Float:px, Float:py, Float:pz;
GetPlayerPos(CopMarker, px, py, pz);
SetPlayerCheckpoint(i, px, py, pz, 5.0);
}
}
and the command :
pawn Код:
CMD:chase(playerid, params[])
{
if(IsACop(playerid))
{
CopMarker= playerid;
return 1;
}
}
Re: Chase CMD, Updating of Marker -
firemanjv - 25.09.2013
Okay thank this really helped me a lot, but could you explain a bit more about the timer, I know I'm just a noob...
and what do I have to do with this??
Код:
CMD:chase(playerid, params[])
{
new string[128], Float:bkx, Float:bky, Float:bkz;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO.");
GetPlayerPos(playerid, bkx, bky, bkz);
format(string, sizeof(string), "[Central Dispatch]: %s is in a 10-0, please repsond code:3 (With Lights & Sirens)", RPN(playerid));
SendCopMessage(COLOR_RADIO, string);
foreach(Player, i)
{
if(IsACop(i))
{
SetPlayerMapIcon(i, 99, bkx, bky, bkz, 0, COLOR_BLUE, 3);
}
}
return 1;
}
Because you gave me another CMD script... and I already got this one..
Re: Chase CMD, Updating of Marker -
MAFIAWARS - 25.09.2013
pawn Код:
CMD:chase(playerid, params[])
{
new string[128], Float:bkx, Float:bky, Float:bkz;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(IsPlayerConnected(CopMarker) || CopMarker!= -1)
{
if(IsACop(i))
{
new Float:px, Float:py, Float:pz;
GetPlayerPos(CopMarker, px, py, pz);
SetPlayerCheckpoint(i, px, py, pz, 5.0);
}
}
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO.");
GetPlayerPos(playerid, bkx, bky, bkz);
format(string, sizeof(string), "[Central Dispatch]: %s is in a 10-0, please repsond code:3 (With Lights & Sirens)", RPN(playerid));
SendCopMessage(COLOR_RADIO, string);
foreach(Player, i)
{
if(IsACop(i))
{
SetPlayerMapIcon(i, 99, bkx, bky, bkz, 0, COLOR_BLUE, 3);
}
}
return 1;
}
Don't forget to define the Timer of Cop.
Re: Chase CMD, Updating of Marker -
firemanjv - 25.09.2013
Okay, So now the only thing left is the timer.. but thats the point I didn't get... So please and example