//let code be called when typed /changev
//let id == parameter entered after /changev
//let id be an integer between 400 and 611
//let player be in a vehicle and driver of said vehicle
new cid = GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z, Float:a,
Float:vX, Float:vY, Float:vZ;
GetVehiclePos(cid, x, y, z);
GetVehicleZAngle(cid, a);
DestroyVehicle(cid);
new nid = CreateVehicle(id, x, y, z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, nid, 0);
SetVehicleVelocity(nid, vX, vY, vZ);
pawn Код:
|
if(strcmp(cmd, "/vch", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] <= 2)
{
SendClientMessage(playerid, COLOR_RED, " [ERROR:] You are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
return 1;
}
new id;
if(id < 1 || id > 611)
{
SendClientMessage(playerid, COLOR_RED, " [ERROR:] Vehicle Number can't be below 400 or above 611!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
return 1;
}
new cid = GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z, Float:a,
Float:vX, Float:vY, Float:vZ;
GetVehiclePos(cid, x, y, z);
GetVehicleZAngle(cid, a);
DestroyVehicle(cid);
new nid = CreateVehicle(id, x, y, z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, nid, 0);
SetVehicleVelocity(nid, vX, vY, vZ);
format(string, sizeof(string), "[SERVER:] Your vehicle has been successfully changed. Vehicle ID:%d", nid);
SendClientMessage(playerid, COLOR_GREEN, string);
}
return 1;
}
if(strcmp(cmd, "/vch", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] <= 2)
{
SendClientMessage(playerid, COLOR_RED, " [ERROR:] You are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
return 1;
}
new id;
if(id < 1 || id > 611)
{
SendClientMessage(playerid, COLOR_RED, " [ERROR:] Vehicle Number can't be below 400 or above 611!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
return 1;
}
new cid = GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z, Float:a,
Float:vX, Float:vY, Float:vZ;
GetVehiclePos(cid, x, y, z);
GetVehicleZAngle(cid, a);
DestroyVehicle(cid);
new nid
nid = CreateVehicle(id, x, y, z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, nid, 0);
SetVehicleVelocity(nid, vX, vY, vZ);
format(string, sizeof(string), "[SERVER:] Your vehicle has been successfully changed. Vehicle ID:%d", nid);
SendClientMessage(playerid, COLOR_GREEN, string);
}
return 1;
}
new nid;
if(strcmp(cmd, "/vch", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] <= 2)
{
SendClientMessage(playerid, COLOR_RED, " [ERROR:] You are not authorized to use that command!");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_RED, " [ERROR:] You have to be in a vehicle to use this command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
return 1;
}
new id;
if(id < 1 || id > 611)
{
SendClientMessage(playerid, COLOR_RED, " [ERROR:] Vehicle Number can't be below 400 or above 611!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vch [carid]");
return 1;
}
new cid = GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z, Float:a,
Float:vX, Float:vY, Float:vZ;
GetVehiclePos(cid, x, y, z);
GetVehicleZAngle(cid, a);
SetPlayerPos(playerid,x,y,z+2);
DestroyVehicle(cid);
new nid
nid = CreateVehicle(id, x, y, z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, nid, 0);
SetVehicleVelocity(nid, vX, vY, vZ);
format(string, sizeof(string), "[SERVER:] Your vehicle has been successfully changed. Vehicle ID:%d", nid);
SendClientMessage(playerid, COLOR_GREEN, string);
}
return 1;
}