On/off triggering of a player blip on radar
#1

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
Reply
#2

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;
}
Reply
#3

Hey, thanks for your reply. I am however experiencing an undefined symbol "location" error. How do I fix that?
Reply
#4

Do you have Location defined in any way?
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)