23.12.2014, 15:29
Here is the code :
And the defines:
There is extra define i know
The other command:
But when the player type /finish the cars still wehn the evented created again !
Please Help !
PHP код:
CMD:ev(playerid, params[])
{
new world = GetPlayerVirtualWorld(playerid);
if(world != 0)
{
new color1, color2, id[128], string[144];
if(sscanf(params, "s[64]dd", id, color1, color2)) return SendClientMessage(playerid, ~1, "{FF0000}|!| {FF9500}Usage: {FFFFFF}/spawncar (Name) (color1) (color2)");
new car = GetVehicleModelIDFromName(id);
if(car < 400 || car > 611) return SendClientMessage(playerid, ~1, "Vehicle ID can't be below {FF0000}400 {FFFFFF}or above {FF0000}611");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
X += (5 * floatsin(-A, degrees));
Y += (5 * floatcos(-A, degrees));
new cars = CreateVehicle(car, X, Y, Z, 0.0, color1, color2, -1);
new pint = GetPlayerInterior(playerid);
LinkVehicleToInterior(cars, pint);
new pworld = GetPlayerVirtualWorld(playerid);
SetVehicleVirtualWorld(cars, pworld);
cars++;
format(string, sizeof string, "Vehicle {FF9500}%s(%d) {FFFFFF}spawned.", VehicleList[GetVehicleModel(cars)-400], cars);
SendClientMessage(playerid, ~1, string);
printf(string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You can't use this command right now !");
}
return 1;
}
PHP код:
new Vehicle[MAX_PLAYERS];
new cars = 0;
new cars = CreateVehicle(car, X, Y, Z, 0.0, color1, color2, -1);
The other command:
PHP код:
CMD:finish(playerid, params[])
{
if(Events > 0)
{
Events -= 1;
SendClientMessage(playerid, COLOR_GREEN, "Event finsihed !");
SetPlayerVirtualWorld(playerid, 0);
DestroyVehicle(cars);
else
{
SendClientMessage(playerid, COLOR_RED, "There isn't any running event !");
}
return 1;
}
Please Help !