CMD:acar(playerid, params[]) { if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在不登陆的情况下使用。"); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在车内使用。"); new vid; if(sscanf(params, "u", vid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]使用方法:/acar (vid)"); if(vid < 400 || vid > 600) return SendClientMessage(playerid, COLOR_GREY, "[提示]无效的车辆ID,请查阅Wiki。"); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); CreateVehicle(vid, x, y, z, 0, 0, 0, 0); return 1; }
CMD:acar(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在不登陆的情况下使用。");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在车内使用。");
new vid;
if(sscanf(params, "i", vid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]使用方法:/acar (vid)");
if(vid < 400 || vid > 600) return SendClientMessage(playerid, COLOR_GREY, "[提示]无效的车辆ID,请查阅Wiki。");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(vid, x, y, z, 0, 0, 0, 0);
return 1;
}
This forum requires that you wait 120 seconds between posts. Please try again in 21 seconds. |
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在不登陆的情况下使用。");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在车内使用。");
new vid;
if(sscanf(params, "i", vid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]使用方法:/acar (vid)");
if(vid < 400 || vid > 600) return SendClientMessage(playerid, COLOR_GREY, "[提示]无效的车辆ID,请查阅Wiki。");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(vid, x+2, y, z+2, 0, 0, 0, 0);
return 1;
}
This is ok but it will create the vehicle at the players positions and that can be annoying. So here is what i did:
pawn Код:
|
Instead of that they could inject a code
PutPlayerInVehicle(playerid, vid); I'm pretty sure theres another parameter I'm missing |
PutPlayerInVehicle(playerid, vid, 0);
CMD:acar(playerid, params[]) { if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在不登陆的情况下使用。"); if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]此命令无法在车内使用。"); new vid, vcar; if(sscanf(params, "i", vid)) return SendClientMessage(playerid, COLOR_GREY, "[提示]使用方法:/acar (vid)"); if(vid < 400 || vid > 600) return SendClientMessage(playerid, COLOR_GREY, "[提示]无效的车辆ID,请查阅Wiki。"); new Float:x, Float:y, Float:z, Float:angle; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle); vcar = CreateVehicle(vid, x, y, z, angle, 0, 0, 0); PutPlayerInVehicle(playerid, vcar, 0); return 1; }