dcmd_veh(playerid,params[])
{
new vehid = GetVehicleModelIDFromName(tmp);
if(sscanf(params,"d",vehid)) {
SendClientMessage(playerid,GREEN,"[USAGE] /veh [VEHID]");
}
else if(vehid < 400 || vehid > 611) {
SendClientMessage(playerid,RED,"[ERROR] VehicleID can't be below 400 or above 611 or false name given.");
}
else {
new Float:x, Float:y, Float:z, 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 i = GetPlayerInterior(playerid);
new v = CreateVehicle(vehid, x, y, z, a+90, -1, -1, 0);
LinkVehicleToInterior(v, i);
new string[100];
format(string, sizeof(string), "Car with id %s has been spawned", aVehicleNames[vehid - 400]);
SendClientMessage(playerid, GREEN, string);
}
return 1;
}
Originally Posted by KnooL
I added the GetVehicleModelFromID thing,
pawn Code:
new vehid = GetVehicleModelIDFromName(tmp); (C:\server\gamemodes\beta.pwn(83 : error 017: undefined symbol "tmp") Original topic: http://forum.sa-mp.com/index.php?topic=62210.0 |
dcmd_veh(playerid,params[])
{
new vehid[56] = GetVehicleModelIDFromName(params);
if(sscanf(params,"s",vehid)) return SendClientMessage(playerid,GREEN,"[USAGE] /veh [Vehicle Name]");
else
{
new Float:x, Float:y, Float:z, 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 i = GetPlayerInterior(playerid);
new v = CreateVehicle(vehid, x, y, z, a+90, -1, -1, 0);
LinkVehicleToInterior(v, i);
new string[100];
format(string, sizeof(string), "Car with id %s has been spawned", aVehicleNames[vehid - 400]);
SendClientMessage(playerid, GREEN, string);
}
return 1;
}
new vehid; if(IsNumeric(params)) vehid = strval(params); else vehid = GetVehicleModelIDFromName(params); if(vehid < 400 || vehid > 611) return SendClientMessage("Invalid vehicle...);
Originally Posted by Mастерминд
Remove sscanffrom veh command and add this
Code:
new vehid; if(IsNumeric(params)) vehid = strval(params); else vehid = GetVehicleModelIDFromName(params); if(vehid < 400 || vehid > 611) return SendClientMessage("Invalid vehicle...); |
dcmd_veh(playerid,params[])
{
new vehid = GetVehicleModelIDFromName(params);
new vehicle = GetVehicleModelIDFromName(params);
if(!IsNumeric(params)) { // vehid = strval(params);
vehid = GetVehicleModelIDFromName(params);
}
if(IsNumeric(params)) vehid = strval(params);
if(vehid < 400 || vehid > 611) return SendClientMessage(playerid,RED,"[ERROR] VehicleID can't be below 400 or above 611 or false name given.");
new Float:x, Float:y, Float:z;
new Float:a,
string[128];
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1) {
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else {
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new in = CreateVehicle(vehid, x, y, z, a+90, -1, -1, 0);
LinkVehicleToInterior(in, GetPlayerInterior(playerid));
if(!IsNumeric(params)) {
format(string, sizeof(string), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, GREEN, string);
}
if(IsNumeric(params)) {
format(string, sizeof(string), "You have spawned a %s", aVehicleNames[vehid - 400]);
SendClientMessage(playerid, GREEN, string);
}
return 1;
}