SA-MP Forums Archive
OnPlayerClickMap - 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: OnPlayerClickMap (/showthread.php?tid=359271)



OnPlayerClickMap - kbalor - 13.07.2012

It's working cool and fine. But everytime I use right click it goes back to red marker. How to I disable that?

Code below:

Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
	new Babatz = GetPlayerVehicleID(playerid);
	if(!Babatz) SetPlayerPos(playerid, fX, fY, fZ);
	else {new Batz = GetPlayerVehicleSeat(playerid);SetVehiclePos(Babatz,fX,fY,fZ);PutPlayerInVehicle(playerid,Babatz,Batz);}
	return 1;
}



Re: OnPlayerClickMap - clarencecuzz - 13.07.2012

pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
        new Babatz = GetPlayerVehicleSeat(playerid);
    if(!IsPlayerInAnyVehicle)
        {
            SetPlayerPosFindZ(playerid, fX, fY, fZ);
        }
    else
        {
            new Batz = GetPlayerVehicleID(playerid);
            SetVehiclePos(Babatz,fX,fY,fZ);
            PutPlayerInVehicle(playerid,Babatz,Batz);
        }
    return 1;
}
EDIT: There is no actual way to disable to marker automatically, it can only be done manually by the player themself.


Re: OnPlayerClickMap - kbalor - 13.07.2012

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
        new Babatz = GetPlayerVehicleSeat(playerid);
    if(!IsPlayerInAnyVehicle)  <------- Error on this line
        {
            SetPlayerPosFindZ(playerid, fX, fY, fZ);
        }
    else
        {
            new Batz = GetPlayerVehicleID(playerid);
            SetVehiclePos(Babatz,fX,fY,fZ);
            PutPlayerInVehicle(playerid,Babatz,Batz);
        }
    return 1;
}
EDIT: There is no actual way to disable to marker automatically, it can only be done manually by the player themself.
Ohh i see. And for the error:

Код:
(9350) : warning 217: loose indentation
(9350) : error 076: syntax error in the expression, or invalid function call



Re: OnPlayerClickMap - clarencecuzz - 13.07.2012

lol sorry, I'm doing this on an iphone.
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    new Babatz = GetPlayerVehicleSeat(playerid);
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    else
    {
        new Batz = GetPlayerVehicleID(playerid);
        SetVehiclePos(Babatz,fX,fY,fZ);
        PutPlayerInVehicle(playerid,Babatz,Batz);
    }
    return 1;
}



Re: OnPlayerClickMap - kbalor - 13.07.2012

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
lol sorry, I'm doing this on an iphone.
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    new Babatz = GetPlayerVehicleSeat(playerid);
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    else
    {
        new Batz = GetPlayerVehicleID(playerid);
        SetVehiclePos(Babatz,fX,fY,fZ);
        PutPlayerInVehicle(playerid,Babatz,Batz);
    }
    return 1;
}
Works like a charm! thanks man you always help me. Anyway Ill put you in my credits.


Re: OnPlayerClickMap - kbalor - 13.07.2012

Quote:
Originally Posted by kbalor
Посмотреть сообщение
Works like a charm! thanks man you always help me. Anyway Ill put you in my credits.
Didn't notice that. When im in vehicle its not working.. but when im on foot it teleports.


Re: OnPlayerClickMap - Steven82 - 13.07.2012

pawn Код:
if(!IsPlayerInAnyVehicle(playerid))
{
 SetPlayerPosFindZ(playerid, fX, fY, fZ);
}
Because your only executing the code if the player isn't in a vehicle..


Re: OnPlayerClickMap - clarencecuzz - 13.07.2012

pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    else if(IsPlayerInAnyVehicle(playerid))
    {
        new Babatz = GetPlayerVehicleID(playerid);
        new Batz = GetPlayerVehicleSeat(playerid);
        SetVehiclePos(Babatz,fX,fY,fZ);
        PutPlayerInVehicle(playerid,Babatz,Batz);
    }
    return 1;
}
Sorry once again xD


Re: OnPlayerClickMap - kbalor - 13.07.2012

Quote:
Originally Posted by Steven82
Посмотреть сообщение
pawn Код:
if(!IsPlayerInAnyVehicle(playerid))
{
 SetPlayerPosFindZ(playerid, fX, fY, fZ);
}
Because your only executing the code if the player isn't in a vehicle..
what should I do now? Can you give me the whole script? thanks!


Re: OnPlayerClickMap - kbalor - 13.07.2012

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    else if(IsPlayerInAnyVehicle(playerid))
    {
        new Babatz = GetPlayerVehicleID(playerid);
        new Batz = GetPlayerVehicleSeat(playerid);
        SetVehiclePos(Babatz,fX,fY,fZ);
        PutPlayerInVehicle(playerid,Babatz,Batz);
    }
    return 1;
}
Lol you killed it once again! thanks mate.
Sorry once again xD
Also VirtualWorld thing fixed another thanks! +rep

Can i ask something??