06.04.2012, 13:12
Hello,
I've got a problem with this command. /goto car ID should teleport me to the car. But the problem is, that the command wont work. The usage of /goto car works, but the ID wont work! Is there any faults in this code? And how can I fix the problem?
I hope, anyone can help me!
Regards, ThomasTailor93
I've got a problem with this command. /goto car ID should teleport me to the car. But the problem is, that the command wont work. The usage of /goto car works, but the ID wont work! Is there any faults in this code? And how can I fix the problem?
pawn Код:
ocmd:goto(playerid,params[])
{
if(!IsPlayerConnected(playerid)) return 1;
new carid,giveplayerid,Float:positionx,Float:positiony,Float:positionz,commandtext[15];
GetPlayerName(playerid,PlayerInfo[playerid][pName],MAX_PLAYER_NAME);
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR_GREY,"* You are not authorized, to use this command!");
if(sscanf(params,"s[15]",commandtext))
{
SendClientMessage(playerid,COLOR_GREY,"USAGE: /goto [Text]");
SendClientMessage(playerid,COLOR_GREY,"available positions: ls,lv,sf,car,mark,player");
return 1;
}
if(strcmp(commandtext,"car",true) == 0)
{
if(sscanf(params,"i",carid)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /goto car [ID]");
GetVehiclePos(carid,positionx,positiony,positionz);
if(GetPlayerState(playerid) == 2)
{
SetVehiclePos(GetPlayerVehicleID(playerid),positionx,positiony,positionz);
TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
}
else SetPlayerPos(playerid,positionx,positiony,positionz);
SendClientMessage(playerid, COLOR_YELLOW, "* You have been teleported to this car!");
SetPlayerInterior(playerid,0);
}
return 1;
}
Regards, ThomasTailor93