08.06.2012, 17:21
Can someone convert this to ZCMD ausing SSCAF, i failed at doing it.
pawn Код:
new cmd[200], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/v", true, 4) == 0)
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,red, "HINT /v [car name]");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid,red, "That vehicle name you have given was not found, please try again!");
if(Veh[playerid][VehId] == -1)
{
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
else
{
DestroyVehicle(Veh[playerid][VehId]);
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid,green, String);
return 1;
}
return 0;
}