[Solved] -
speedruntrainer - 02.08.2009
Код:
if(strcmp(cmdtext, "/lowrider", true) == 0) {
ResetPlayerWeapons(playerid);
SetPlayerPos(playerid,2645.40, -2004.71, 13.38);
GivePlayerMoney(playerid, 50000);
return 1;
}
So, if a player is in a car, he still teleports on foot. what's the problem?
Re: Can't teleport with car to tune. only on foot :O what do I wrong here? -
Correlli - 02.08.2009
Use IsPlayerInAnyVehicle check and use SetVehiclePos.
Re: Can't teleport with car to tune. only on foot :O what do I wrong here? -
speedruntrainer - 02.08.2009
Ok, will try it. I post back when it either works or doesn't work.
Re: Can't teleport with car to tune. only on foot :O what do I wrong here? -
speedruntrainer - 02.08.2009
Still not works :/
Код:
if(strcmp(cmdtext, "/lowrider", true) == 0) {
new vehicleid;
ResetPlayerWeapons(playerid);
IsPlayerInAnyVehicle(playerid);
SetVehiclePos(vehicleid, 2645.40, -2004.71, 13.38);
SetPlayerPos(playerid,2645.40, -2004.71, 13.38);
GivePlayerMoney(playerid, 50000);
return 1;
}
Can somebody please help? it still not worked.
Re: Can't teleport with car to tune. only on foot :O what do I wrong here? -
Correlli - 02.08.2009
pawn Код:
if(strcmp(cmdtext, "/lowrider", true) == 0)
{
ResetPlayerWeapons(playerid);
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), 2645.40, -2004.71, 13.38);
else SetPlayerPos(playerid, 2645.40, -2004.71, 13.38);
GivePlayerMoney(playerid, 50000);
return 1;
}
Re: Can't teleport with car to tune. only on foot :O what do I wrong here? -
speedruntrainer - 02.08.2009
zOMFG Thanks!!!
Nice man.
EDIT: You can also teleport without car. how to prevent that?
Re: Can't teleport with car to tune. only on foot :O what do I wrong here? -
.::: Ecko :::. - 02.08.2009
Quote:
Originally Posted by speedruntrainer
zOMFG Thanks!!! Nice man.
EDIT: You can also teleport without car. how to prevent that?
|
Without car just do SetPlayerPos(playerid,Float
,Float:y,Float:z);
With that your player will be teleported to x,y,z .Without any other vehicle.
Ecko
Re: [Half solved] still 1 question. -
speedruntrainer - 02.08.2009
Eh I mean, If the player IS NOT in a vehicle, he can't teleport. "You must be in a vehicle to use this command" That's what I'm trying to tell you. >.<
pawn Код:
if(strcmp(cmdtext, "/lowrider", true) == 0) {
ResetPlayerWeapons(playerid);
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), 2645.40, -2004.71, 13.38);
else SetPlayerPos(playerid, 2645.40, -2004.71, 13.38);
GivePlayerMoney(playerid, 50000);
return 1;
}
Re: Can't teleport with car to tune. only on foot :O what do I wrong here? -
Correlli - 02.08.2009
Quote:
Originally Posted by Don Correlli
pawn Код:
if(strcmp(cmdtext, "/lowrider", true) == 0) { ResetPlayerWeapons(playerid); if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), 2645.40, -2004.71, 13.38); else SetPlayerPos(playerid, 2645.40, -2004.71, 13.38); GivePlayerMoney(playerid, 50000); return 1; }
|
As you can see, if he is any vehicle then player and vehicle will be teleported (SetVehiclePos), if not then only player will be teleported (SetPlayerPos).
If you want to prevent teleporting on foot, change:
pawn Код:
else SetPlayerPos(playerid, 2645.40, -2004.71, 13.38);
to:
pawn Код:
else SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: You can't teleport if you're not in vehicle!");
You maybe want to add PLAYER_STATE_DRIVER check so only driver of the vehicle can teleport it.
Re: [Half solved] still 1 question. -
Dj_maryo1993 - 02.08.2009
pawn Код:
if(strcmp(cmdtext, "/lowrider", true) == 0)
{
ResetPlayerWeapons(playerid);
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), 2645.40, -2004.71, 13.38);
else SendClientMessage(playerid, 0x0000BBAA , " You can do this only if you are in an vehicle");
GivePlayerMoney(playerid, 50000);
return 1;
}
Does this work
?
Don Correlli it seems that you edited in the same time with my post
.