25.09.2015, 16:25
Hello, I am trying to create a vehicle in my server and when I do the command it let me make one vehicle, It let me change the model,type,color, ect.. Now I go to make another one and do the stuff it says unknow command
Here is the command
To Create:
To Change the model and color
Here is the command
To Create:
Код:
if(strcmp(cmd, "/vcreate", true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 5) { new Float:x,Float:y,Float:z; new Float:a; new car; //new thecar = GetVehicleModel(vehicleid); GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); DynamicCars[car][CarModel] = 500; DynamicCars[car][CarX] = x; DynamicCars[car][CarY] = y; DynamicCars[car][CarZ] = z; DynamicCars[car][CarAngle] = a; DynamicCars[car][FactionCar] = 9; DynamicCars[car][CarType] = 0; DynamicCars[car][CarColor1] = 1; DynamicCars[car][CarColor2] = 1; CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1); SaveDynamicCars(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "You're not an administrator."); } } return 1; }
Код:
if(strcmp(cmd, "/vmodel", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "USAGE: /vmodel [modelid]"); return 1; } new thecar = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 5) { if(IsPlayerInAnyVehicle(playerid)) { if(thecar > 400 && thecar < 611) { new car = GetPlayerVehicleID(playerid) - 1; new vehicleid = GetPlayerVehicleID(playerid); DynamicCars[car][CarModel] = thecar; new wstring[128]; format(wstring, sizeof(wstring), "You've set Vehicle ID %d's model to: %d.", vehicleid,thecar); SendClientMessage(playerid,COLOR_ADMINCMD, wstring); new Float:cx,Float:cy,Float:cz; GetVehiclePos(vehicleid,cx,cy,cz); new Float:angle; GetVehicleZAngle(vehicleid, angle); DestroyVehicle(vehicleid); CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1); PutPlayerInVehicle(playerid,vehicleid,0); SetVehiclePos(vehicleid, cx, cy, cz); SetVehicleZAngle(vehicleid, angle); SaveDynamicCars(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Incorrect Model ID, Correct Model ID's: 400-611."); } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "You're not in a vehicle!"); } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "You're not an administrator."); } } return 1; } if(strcmp(cmd, "/vcolor", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "USAGE: /vcolor [colorid] [colorid]"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 5) { if(IsPlayerInAnyVehicle(playerid)) { new color1; color1 = strval(tmp); if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR] 0-126 = Valid Colors."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "USAGE: /vcolor [colorid] [colorid]"); return 1; } new color2; color2 = strval(tmp); if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR] 0-126 = Valid Colors."); return 1; } new car = GetPlayerVehicleID(playerid) - 1; new vehicleid = GetPlayerVehicleID(playerid); DynamicCars[car][CarColor1] = color1; DynamicCars[car][CarColor2] = color2; new wstring[128]; format(wstring, sizeof(wstring), "You've set Vehicle ID %d's colors to: %d-%d.", vehicleid,color1,color2); SendClientMessage(playerid,COLOR_ADMINCMD, wstring); new Float:cx,Float:cy,Float:cz; GetVehiclePos(vehicleid,cx,cy,cz); new Float:angle; GetVehicleZAngle(vehicleid, angle); DestroyVehicle(vehicleid); CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1); PutPlayerInVehicle(playerid,vehicleid,0); SetVehiclePos(vehicleid, cx, cy, cz); SetVehicleZAngle(vehicleid, angle); SaveDynamicCars(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "You're not in a vehicle!"); } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "You're not an administrator."); } } return 1; }