Car Teleporting. -
milanosie - 17.01.2012
Hello everybody! This isn't really a filterscript but I will explain you how to use it
This command lets you teleport
existing cars to you and let you teleport to cars.
All you have to do is add it in your gamemode and use your own define to check if someone is admin,
This probably is created before but I just wanted to share this.
Код:
CMD:getcar(playerid, params[])
{
new vehid;
if(!sscanf(params, "d", vehid))
{
if(PlayerInfo[playerid][AdminLevel] >= 4) //DEFINE YOUR OWN ADMIN SYSTEM HERE. THIS IS JUST AN EXAMPLE!!!
{
new string[64];
new Float:Xc, Float:Yc, Float:Zc;
GetPlayerPos(playerid, Xc, Yc, Zc);
SetVehiclePos(vehid, Xc+5, Yc, Zc);
format(string, sizeof(string), "You teleported vehicle %d to you!", vehid);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use that command!");
}
else return SendClientMessage(playerid, COLOR_GREY, "USAGE: /getcar [vehicle ID]");
}
CMD:gotocar(playerid, params[])
{
new vehid;
if(!sscanf(params, "d", vehid))
{
if(PlayerInfo[playerid][AdminLevel] >=4) //DEFINE YOUR OWN ADMIN SYSTEM HERE! THIS IS JUST AN EXAMPLE!!!
{
new string[64];
new Float:Xv, Float:Yv, Float:Zv;
GetVehiclePos(vehid, Xv, Yv, Zv);
SetPlayerPos(playerid, Xv+1, Yv, Zv);
format(string, sizeof(string), "You teleported to vehicle %d!", vehid);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command!");
}
else return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotocar [vehicle ID]");
}
For the people who use strcmp (Wich I don't recommend)
ADD THIS UNDER Public OnPlayerCommand
Код:
if(!strcmp(cmdtext, "/getcar", true)
{
new vehid;
if(!sscanf(params, "d", vehid))
{
if(PlayerInfo[playerid][AdminLevel] >= 4) //DEFINE YOUR OWN ADMIN SYSTEM HERE! THIS IS JUST AN EXAMPLE!!!
{
new string[64];
new Float:Xc, Float:Yc, Float:Zc;
GetPlayerPos(playerid, Xc, Yc, Zc);
SetVehiclePos(vehid, Xc+5, Yc, Zc);
format(string, sizeof(string), "You teleported vehicle %d to you!", vehid);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use that command!");
}
else return SendClientMessage(playerid, COLOR_GREY, "USAGE: /getcar [vehicle ID]");
}
if(!strcmp(cmdtext, "/gotocar", true)
{
new vehid;
if(!sscanf(params, "d", vehid))
{
if(PlayerInfo[playerid][AdminLevel] >=4) //DEFINE YOUR OWN ADMIN SYSTEM HERE! THIS IS JUST AN EXAMPLE!!!
{
new string[64];
new Float:Xv, Float:Yv, Float:Zv;
GetVehiclePos(vehid, Xv, Yv, Zv);
SetPlayerPos(playerid, Xv+1, Yv, Zv);
format(string, sizeof(string), "You teleported to vehicle %d!", vehid);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command!");
}
else return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotocar [vehicle ID]");
}
This script is very very simple and I hope that the newer scripters learn something from this
Re: Car Teleporting. -
milanosie - 17.01.2012
No reactions at all?
Re: Car Teleporting. -
xSiiLenTx - 17.01.2012
I like it
Re: Car Teleporting. -
kizla - 17.01.2012
Maybe you post it here?
https://sampforum.blast.hk/showthread.php?tid=281