Unworking /v command.
#1

Okay, I just found this /v command but for some reason, it doesn't work. It returns me with "A vehicle has been spawned near you!" but no cars are spawned near me.. if anyone could help, it'd meean alot.

Quote:

CMD:v(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
else
{
new vehid;new b1;new b2;new targetid[MAX_PLAYER_NAME];
if(sscanf(params, "uiii", targetid,vehid,b1,b2)) SendClientMessage(playerid, -1, "Use: /v [id] [car id] [color 1] [color 2]");
else if(vehid < 400 || vehid > 611) return SendClientMessage(playerid, -1, "Wrong car id! ( 400-600)");
else if(vehid == 425 || vehid == 520 || vehid == 537 || vehid == 538 || vehid == 569 || vehid == 570 || vehid == 590) return SendClientMessage(playerid, -1, "You can't spawn a hydra and the rest military vehicles!");
else if(b2 <=0 || b2 >= 252) return SendClientMessage(playerid, -1, "Wrong color 1 id!");
else if(b1 <=0 || b1 >= 252) return SendClientMessage(playerid, -1, "Wrong color 2 id!");
else
{
GetPlayerName(playerid, targetid, MAX_PLAYER_NAME);
new Float, Float:y, Float:z;new Float:kut;
GetPlayerPos(MAX_PLAYER_NAME, x, y, z);
GetPlayerFacingAngle(playerid, kut);
CreateVehicle(vehid, x + 3, y + 1, z, kut, b1, b2, -1);
SendClientMessage(playerid, -1, "You have spawned a car near you!");
}
}
return 1;
}

Reply
#2

Try this: I think the mistake you done is using wrong parameters of player.
pawn Код:
CMD:v(playerid, params[])
{
 if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
new vehid;new b1;new b2;new targetid;
 if(sscanf(params, "uiii", targetid,vehid,b1,b2)) SendClientMessage(playerid, -1, "Use: /v [id] [car id] [color 1] [color 2]");
 if(vehid < 400 || vehid > 611) return SendClientMessage(playerid, -1, "Wrong car id! ( 400-600)");
 if(vehid == 425 || vehid == 520 || vehid == 537 || vehid == 538 || vehid == 569 || vehid == 570 || vehid == 590) return SendClientMessage(playerid, -1, "You can't spawn a hydra and the rest military vehicles!");
 if(b2 <=0 || b2 >= 252) return SendClientMessage(playerid, -1, "Wrong color 1 id!");
 if(b1 <=0 || b1 >= 252) return SendClientMessage(playerid, -1, "Wrong color 2 id!");
 new Lname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, Lname, sizeof(Lname));
 new Float:x, Float:y, Float:z;
 new Float:kut;
 GetPlayerPos(playerid, x, y, z);
 GetPlayerFacingAngle(playerid, kut);
 CreateVehicle(vehid, x + 3, y + 1, z, kut, b1, b2, -1);
 SendClientMessage(playerid, -1, "You have spawned a car near you!");
 return 1;
}
Please use PAWN tags or CODE tags next time instead of QUOTE tags.

PS:Not sure if this is correct as I'm on mobile.
Reply
#3

Thank you very much, it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)