Bonjour,
J'ai créé ma propre commande de spawn de véhicule en utilisant ZCMD & SSCANF.
J'ai donc procédé ainsi:
CMD:v(playerid, params[])
{
new vId, c1, c2, float:posX, float:posY, float:posZ, a;
if(sscanf(params, "iI(0)I(0)", vId, c1, c2))
{
SendClientMessage(playerid, COLOR_YELLOW, "Usage: /v <id> <col1> <col2>");
}
if(vId == 609)
{
GetPlayerPos(playerid, posX, posY, posZ);
GetXYInFrontOfPlayer(playerid, posX, posY, 5.0);
CreateVehicle(vId, posX, posY, posZ, 0.0, c1, c2, 0);
}
else if(vId > 605 || vId < 400)
{
SendClientMessage(playerid, COLOR_RED, "L'id du véhicule doit être compris entre 400 et 605. Excepté 609 (Boxville)");
}
else
{
GetPlayerPos(playerid, posX, posY, posZ);
GetXYInFrontOfPlayer(playerid, posX, posY, 5.0);
CreateVehicle(vId, posX, posY, posZ, 0.0, c1, c2, 0);
}
return 1;
}
Et donc, je souhaiterai que si le joueur n'entre pas de couleur dans la commande, que la couleur soit "randomisé"...
J'ai essayé comme ça, mais ça me dit que j'ai créé une variable que j'utilise jamais

:
new a = random(200);
if(sscanf(params, "iI(a)I(a)", vId, c1, c2))
Voilà, si quelqu'un pouvait m'éclairer ce serait sympa, bonne journée
