17.02.2016, 22:28
Hey I was wondering if anyone could help me with making these to cmds for my scripting
CMD:createpvehicle(playerid, params[])
{
// ur admin system here
new string[128], giveplayerid, modelid, color1, color2;
if(sscanf(params, "uddd", giveplayerid, modelid, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /createpvehicle [playerid/partofname] [modelid] [color 1] [color 2]");
if(color1 < 0 || color1 > 255) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 255!"); return 1; }
if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 255!"); return 1; }
if(modelid < 400 || modelid > 611) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611!"); return 1; }
new playervehicleid = GetPlayerFreeVehicleId(giveplayerid);
new carsamount = GetPlayerVehicleCount(giveplayerid);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid,X,Y,Z);
new Float:Angle;
GetPlayerFacingAngle(giveplayerid,Angle);
new car = CreatePlayerVehicle(giveplayerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0);
if(car == INVALID_PLAYER_VEHICLE_ID)
{
SendClientMessage(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created.");
}
else
{
format(string, sizeof(string), " Vehicle successfully created with ID %d.", car);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
return 1;
}
Rep if it worked.
PHP код:
|