On/off triggering of a player blip on radar - 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)
+--- Thread: On/off triggering of a player blip on radar (
/showthread.php?tid=302172)
On/off triggering of a player blip on radar -
HighFlyer - 07.12.2011
Hello there,
I am doing a simple gamemode to learn Pawno, and I wanted to construct a command in which a player can show his location to others by using the command
Код:
dcmd_showlocation(playerid, params[])
#pragma unused params
{
if { SetPlayerMarkerForPlayer( playerid, showplayerid, 0xFF0000FF ); }
else { SetPlayerMarkerForPlayer( playerid, showplayerid, 0xFF0000FF ); }
}
The trouble is that I want the location to show to all players, and Pawno on compiling shows undefined symbol "showplayerid"... The wiki says (playerid, showplayerid, color). I can only assume I misinterpreted showplayerid. How can I make it so it shows to all of the players connected?
Thanks in advance
Respuesta: On/off triggering of a player blip on radar -
OPremium - 07.12.2011
If you want to change it for ALL players, then you can use SetPlayerColor instead. You will also need a variable to know if the player is showing his location or not.
pawn Код:
//Top of script
bool:location[MAX_PLAYERS]; //Stores if the players is showing his location or not
//OnPlayerConnect
public OnPlayerConnect(playerid)
{
location = false; //Location will be HIDDEN by default
SetPlayerColor(playerid, 0xFF000000); //^
//Rest of your code
}
//Command
dcmd_showlocation(playerid, params[])
#pragma unused params
{
if(!location[playerid]) //If location is hidden...
{
location[playerid] = true;
SetPlayerColor(playerid, 0xFF0000FF); //Sets the player's marker to RED
//Here you can add more code, like sending a message to the player that typed the command, etc.
}
else
{
location[playerid] = false;
SetPlayerColor(playerid, 0xFF000000); //Sets the player's marker to RED with 100% of transparency = HIDDEN
//Here you can add more code, like sending a message to the player that typed the command, etc.
}
return 1;
}
Re: On/off triggering of a player blip on radar -
HighFlyer - 10.12.2011
Hey, thanks for your reply. I am however experiencing an undefined symbol "location" error. How do I fix that?
Re: On/off triggering of a player blip on radar -
BleverCastard - 10.12.2011
Do you have Location defined in any way?
Re: On/off triggering of a player blip on radar -
HighFlyer - 10.12.2011
Not really, no. How would I define that? An example would be useful please, still quite fresh to Pawno
I tried new location [MAX_PLAYERS]; instead of bool:location [MAX_PLAYERS]; but that returns a couple of more different errors.