CMD:mycar(playerid, params[]){new vid[30], Float:x, Float:y, Float:z, Float:ang, color1[4], color2[4];if(sscanf(params, \"sss\", vid, color1, color2)) SendClientMessage(playerid, COLOR_YELLOW, \"[HASZNÁLAT]: /mycar <jármûnév> <szín1> <szín2>\");else if(color1 > 0 && color2 > 0){new vehicle;vehicle = GetVehicleModelIDFromName(vid); GetPlayerPos(playerid, x, y, z);new vehicle2 = CreateVehicle(vehicle, x, y, z, GetPlayerFacingAngle(playerid, ang), -1, -1, -1);PutPlayerInVehicle(playerid, vehicle2, 0);PlayerPlaySound(playerid, 1138, 0.0,0.0,0.0); }else if(color2 > 0){new vehicle;vehicle = GetVehicleModelIDFromName(vid); GetPlayerPos(playerid, x, y, z);new vehicle2 = CreateVehicle(vehicle, x, y, z, GetPlayerFacingAngle(playerid, ang), color1, -1, -1);PutPlayerInVehicle(playerid, vehicle2, 0);PlayerPlaySound(playerid, 1138, 0.0,0.0,0.0);}else{new vehicle;vehicle = GetVehicleModelIDFromName(vid); GetPlayerPos(playerid, x, y, z);new vehicle2 = CreateVehicle(vehicle, x, y, z, GetPlayerFacingAngle(playerid, ang), color1, color2, -1);PutPlayerInVehicle(playerid, vehicle2, 0);PlayerPlaySound(playerid, 1138, 0.0,0.0,0.0);}return 1;}
else if(color1 > 0 && color2 > 0)
else if(color2 > 0)
new vehicle2 = CreateVehicle(vehicle, x, y, z, GetPlayerFacingAngle(playerid, ang), color1, -1, -1);
new vehicle2 = CreateVehicle(vehicle, x, y, z, GetPlayerFacingAngle(playerid, ang), color1, color2, -1);
CMD:mycar(playerid, params[]){new vid[30], Float:x, Float:y, Float:z, Float:ang, color1, color2;if(sscanf(params, \"s[20]dd\", vid, color1, color2)) SendClientMessage(playerid, COLOR_YELLOW, \"[HASZNÁLAT]: /mycar <jármûnév> <szín1> <szín2>\");
Az elhanyagolható paramétereket nagy betûvel jelöljük. Esetedben: DD
sscanf warning: No default value found
D(-1)D(-1)
Igen, mert lemaradt a zárójel.. D(-1)D(-1) Így ha nem írja be a színeket, akkor véletlenszerûen add 1et.
Nagyon szétvan darabolva a parancsod! Ennél 1xübben is meglehetne oldani, de most nemtudom átírni neked, mert sok a dolgom. :angel:De, ModelID alapján tudsz autót tiltani..[pawn]if ( vehicle != /* ModelID */ ) return SendClientMessage ( playerid, 0x0000FF, \"Hiba: Tiltott kocsit akartál spawnolni!\" );{[/pawn]