16.11.2012, 14:13
Hi!
Recently I've added a filterscript to my new server, but unluckily I cannot get it work properly!
That's the code:
But I got a problem: I select a place to teleport and also If I press "Close" it teleports me there!
I'm not so good at scripting so I don't really know what can cause this problem.. Any gentlemen helping me?
Thanks so much!
Recently I've added a filterscript to my new server, but unluckily I cannot get it work properly!
That's the code:
pawn Код:
CMD:teleport(playerid, params[])
{
ShowPlayerDialog(playerid, 1997, DIALOG_STYLE_LIST, "Teleport System in Dialog", "San Fierro\nLos Santos\nLas Venturas", "Teleport", "Close"); // Dialogid 1997 ? you can change it or maybe define it . .
//ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
return 1;
}
//----------------------------------------------------------------------------//
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1997) // Check the Dialogid
{
switch(listitem) //the list of the item you have in the Dialog ..
{
case 0: // case 0; is for San Fierro teleport . .
{
new vehicleid = GetPlayerVehicleID(playerid); // check the vehicleID
new State = GetPlayerState(playerid); // Get the playerState
if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER) // this will teleport you & your car if you are the driver...
//if you are not the driver or you maybe a passenger u will just teleport without car ..
{
LinkVehicleToInterior(vehicleid,0); //Linkvehicle to interior,this is like SetPlayerInterior . .
SetPlayerInterior(playerid,0); //this will set the playerinterior
SetVehicleZAngle(vehicleid,227.2756); //this is the angle of your vehicle
SetCameraBehindPlayer(playerid); //this will set the camera behind you
SetVehiclePos(vehicleid,-1986.5483,305.5474,35.0071); //this is the vehicle Pos , Float:X , Float:Y , Float:Z
return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to San Fierro!");//this will send u a Message when u was Teleported!. .
}
SetPlayerPos(playerid,-1969.0593,294.0901,35.1719);//this is the Player Pos , Float:X , Float:Y , Float:Z
SetPlayerFacingAngle(playerid,89.9102); //this is the angle of your player
SetPlayerInterior(playerid,0);//this will set the playerinterior
SetCameraBehindPlayer(playerid);//this will set the camera behind you
SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to San Fierro!"); //this will send u a Message when u was Teleported!. .
}
case 1: // case 1; is for Los Santos teleport . .
{
new vehicleid = GetPlayerVehicleID(playerid);// check the vehicleID
new State = GetPlayerState(playerid);// Get the playerState
if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER) // this will teleport you & your car if you are the driver...
//if you are not the driver or you maybe a passenger u will just teleport without car ..
{
LinkVehicleToInterior(vehicleid,0);//Linkvehicle to interior,this is like SetPlayerInterior . .
SetPlayerInterior(playerid,0);//this will set the playerinterior
SetVehicleZAngle(vehicleid,179.2136);//this is the angle of your vehicle
SetCameraBehindPlayer(playerid);//this will set the camera behind you
SetVehiclePos(vehicleid,1608.3900,-1719.7670,13.3786); //this is the vehicle Pos , Float:X , Float:Y , Float:Z
return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Los Santos!");//this will send u a Message when u was Teleported!. .
}
SetPlayerPos(playerid,1606.3514,-1739.5194,13.5469);//this is the Player Pos , Float:X , Float:Y , Float:Z
SetPlayerFacingAngle(playerid,42.2198); //this is the angle of your player
SetPlayerInterior(playerid,0);//this will set the playerinterior
SetCameraBehindPlayer(playerid);//this will set the camera behind you
SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Los Santos!");//this will send u a Message when u was Teleported!. .
}
case 2: // case 2; is for Las Venturas teleport . .
{
new vehicleid = GetPlayerVehicleID(playerid);// check the vehicleID
new State = GetPlayerState(playerid);// Get the playerState
if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)// this will teleport you & your car if you are the driver...
//if you are not the driver or you maybe a passenger u will just teleport without car ..
{
LinkVehicleToInterior(vehicleid,0);//Linkvehicle to interior,this is like SetPlayerInterior . .
SetPlayerInterior(playerid,0);//this will set the playerinterior
SetVehicleZAngle(vehicleid,88.7952);//this is the angle of your vehicle
SetCameraBehindPlayer(playerid);//this will set the camera behind you
SetVehiclePos(vehicleid,2128.2754,1333.6340,10.6558);//this is the vehicle Pos , Float:X , Float:Y , Float:Z
return SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Las Venturas!");//this will send u a Message when u was Teleported!. .
}
SetPlayerPos(playerid,2096.9543,1322.6205,10.8203);//this is the Player Pos , Float:X , Float:Y , Float:Z
SetPlayerFacingAngle(playerid,52.1985); //this is the angle of your player
SetPlayerInterior(playerid,0);//this will set the playerinterior
SetCameraBehindPlayer(playerid);//this will set the camera behind you
SendClientMessage(playerid, COLOR_GRAY, "[TP]:You has been Teleported to Las Venturas!");//this will send u a Message when u was Teleported!. .
}
//Case 3: //add your other tp
}
//your code
}
return 1;
}
I'm not so good at scripting so I don't really know what can cause this problem.. Any gentlemen helping me?
Thanks so much!