#1

i have problem with /goto

pawn Код:
CMD:goto(playerid, params[])
{
    new id, car;
    if(sscanf(params, "u", id))return Use(playerid, "/goto [name/ID]");
    else if(PlayerInfo[playerid][pAdmin] < 1)return SendAdmin(playerid, "Not admin!");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(id, x, y, z);
    SetPlayerPos(playerid, x+1, y, z);
    if(IsPlayerInVehicle(playerid, car))
    {
        SetVehiclePos(car, x, y, z);
        PutPlayerInVehicle(playerid, car, 0);
    }
    SendClientMessage(playerid, Grey, "Teleport.");
    return 1;
}
i can port with car, pls help.. how to port with a car to person?
Reply
#2

Huh? You said you can teleport to a vehicle, but you want to teleport to a vehicle? What's the problem?
Reply
#3

i want to teleport with vehicle to player...
Reply
#4

Currently it does:
pawn Код:
if(IsPlayerInVehicle(playerid, car))
    {
        SetVehiclePos(car, x, y, z);
        PutPlayerInVehicle(playerid, car, 0);
    }
Reply
#5

i have that and dosent work :S
Reply
#6

Quote:
Originally Posted by Speed
Посмотреть сообщение
i have problem with /goto

pawn Код:
CMD:goto(playerid, params[])
{
    new id, car;
    if(sscanf(params, "u", id))return Use(playerid, "/goto [name/ID]");
    else if(PlayerInfo[playerid][pAdmin] < 1)return SendAdmin(playerid, "Not admin!");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(id, x, y, z);
    SetPlayerPos(playerid, x+1, y, z);
    if(IsPlayerInVehicle(playerid, car))
    {
        SetVehiclePos(car, x, y, z);
        PutPlayerInVehicle(playerid, car, 0);
    }
    SendClientMessage(playerid, Grey, "Teleport.");
    return 1;
}
i can port with car, pls help.. how to port with a car to person?
Car is not assigned a value yet, so it's 0.. therefore it won't work. However you can save time and effort by simply adding IsPlayerInAnyVehicle function.

pawn Код:
CMD:goto(playerid, params[])
{
    new id;
    if(sscanf(params, "u", id))return Use(playerid, "/goto [name/ID]");
    else if(PlayerInfo[playerid][pAdmin] < 1)return SendAdmin(playerid, "Not admin!");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(id, x, y, z);
    SetPlayerPos(playerid, x+1, y, z);
     if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
        PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
    }
    SendClientMessage(playerid, Grey, "Teleport.");
    return 1;
}
Reply
#7

pawn Код:
CMD:goto(playerid, params[])
{
    new targetid, Float:X, Float:Y, Float:Z;
    if(sscanf(params,"i", targetid)) return SendClientMessage(playerid, 0xFFFFFFFF,"/goto [PlayerID/PlayerName]");
    if(IsPlayerConnected(targetid) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "TagerID not connected.");
    GetPlayerPos(targetid, X, Y, Z );
    if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
    else SetPlayerPos( playerid, X+2, Y+2, Z );
    return 1;
}
Reply
#8

Код:
CMD:goto(playerid, params[])
{
	new id;
	if(PlayerInfo[playerid][pAdmin] < 1)return SendAdmin(playerid, "Not admin!");
	if(sscanf(params, "u", id))return Use(playerid, "/goto [name/ID]");
	new car=GetPlayerVehicleID(playerid);
	new Float:x, Float:y, Float:z;
	GetPlayerPos(id, x, y, z);
	if(car==0)
	{
		SetPlayerPos(playerid, x+1, y, z);
	}
	else
	{
		SetVehiclePos(car, x+3, y, z);
	}
	SendClientMessage(playerid, Grey, "Teleport.");
	return 1;
}
have a look at the updated sscanf, compiled by Scott, which works well with the "u" specifier:
http://forum.sa-mp.com/showthread.ph...ghlight=sscanf (6th post)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)