07.06.2009, 14:47
Hello, I copied Drug runs and gun runs from other server to my... I compile it without any warnings or errors.
When I go in server and try to /pickdrugs in anyway I get message what I should get, but when Im in position where I can pick them up I get message: SERVER: Unknown command. Heres my script:
When I go in server and try to /pickdrugs in anyway I get message what I should get, but when Im in position where I can pick them up I get message: SERVER: Unknown command. Heres my script:
Код:
enum pHaul { pCapasity, pLoad, pDrugsx, pGunsx, }; new PlayerHaul[100][pHaul]; new Drugs; new Guns; forward SaveStocks();
Код:
//------------------DRUGRUN----------------------------------------------------------------------------- if(strcmp(cmd, "/pickdrugs", true) == 0) { if(IsPlayerConnected(playerid)) { new tmpcar = GetPlayerVehicleID(playerid); if (IsPlayerInAnyVehicle(playerid)) { if(PlayerToPoint(4.0, playerid, -72.8756,-1539.0819,2.6172)) { if(PlayerHaul[tmpcar][pDrugsx] == 0) { tmp = strtok(cmdtext, idx); new check= PlayerHaul[tmpcar][pDrugsx]; if(check > 50) { format(string, sizeof(string), " Your car is full."); SendClientMessage(playerid, COLOR_GREY, string); return 1; } if(GetPlayerMoney(playerid) >= 500000) { PlayerHaul[tmpcar][pDrugsx] = 50; format(string, sizeof(string), " You bought [50] Kilograms of drugs."); SendClientMessage(playerid, TEAM_GROVE_COLOR, string); GivePlayerMoney(playerid,-500000); return 1; } else { format(string, sizeof(string), "ERROR: You need $ 500.000 to buy drugs!"); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You already bought drugs."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You are not at the drugs load place."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You are not in a car."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } return 1; } if(strcmp(cmd, "/putdrugs", true) == 0) { if(IsPlayerConnected(playerid)) { new tmpcar = GetPlayerVehicleID(playerid); if (IsPlayerInAnyVehicle(playerid)) { if(Drugs <= 1000) { if(PlayerToPoint(4.0, playerid, 2735.5935,-2466.1265,13.6484)) { if(PlayerHaul[tmpcar][pDrugsx] == 50) { tmp = strtok(cmdtext, idx); new check= PlayerHaul[tmpcar][pDrugsx]; if(check < 50) { format(string, sizeof(string), " You don't have drugs in the car"); SendClientMessage(playerid, COLOR_GREY, string); return 1; } if(check >= 50) { PlayerHaul[tmpcar][pDrugsx] = 0; Drugs += 50; SaveStocks(); format(string, sizeof(string), " You sold 50Kg's of drugs and recieved $520.000 from the handler."); SendClientMessage(playerid, TEAM_GROVE_COLOR, string); GivePlayerMoney(playerid,520000); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); return 1; } else { format(string, sizeof(string), "ERROR: No drugs in the vehicle!"); SendClientMessage(playerid, COLOR_RED, string); return 1; } } } else { format(string, sizeof(string), "ERROR: You aren't at drugs unload place."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: Drug stock full!!"); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You are not in a car."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } return 1; } //-------gunruns----------------------------------------- if(strcmp(cmd, "/loadguns", true) == 0) { if(IsPlayerConnected(playerid)) { new tmpcar = GetPlayerVehicleID(playerid); if (IsPlayerInAnyVehicle(playerid)) { if(PlayerToPoint(4.0, playerid, -2455.2896,2292.9490,4.9804)) { if(PlayerHaul[tmpcar][pGunsx] == 0) { tmp = strtok(cmdtext, idx); new check= PlayerHaul[tmpcar][pGunsx]; if(check > 30) { format(string, sizeof(string), " You can't buy more guns"); SendClientMessage(playerid, COLOR_GREY, string); return 1; } if(GetPlayerMoney(playerid) >= 500000) { PlayerHaul[tmpcar][pGunsx] = 30; format(string, sizeof(string), "You bought 30 guns."); SendClientMessage(playerid, TEAM_GROVE_COLOR, string); GivePlayerMoney(playerid,-500000); return 1; } else { format(string, sizeof(string), "ERROR: You need 500k to buy guns!"); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You already bought guns."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You are not at the guns load place."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You are not in a car."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } return 1; } if(strcmp(cmd, "/unloadguns", true) == 0) { if(IsPlayerConnected(playerid)) { new tmpcar = GetPlayerVehicleID(playerid); if (IsPlayerInAnyVehicle(playerid)) { if(Guns <= 1000) { if(PlayerToPoint(4.0, playerid, 2801.0029,-1172.8397,25.5841)) { if(PlayerHaul[tmpcar][pGunsx] == 30) { tmp = strtok(cmdtext, idx); new check= PlayerHaul[tmpcar][pGunsx]; if(check < 30) { format(string, sizeof(string), " You don't have guns in the car"); SendClientMessage(playerid, COLOR_GREY, string); return 1; } if(check >= 30) { PlayerHaul[tmpcar][pGunsx] = 0; Guns += 30; SaveStocks(); format(string, sizeof(string), " You sold 30 guns and recieved $520.000 from the handler."); SendClientMessage(playerid, TEAM_GROVE_COLOR, string); GivePlayerMoney(playerid,520000); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); return 1; } else { format(string, sizeof(string), "ERROR: No guns in the vehicle!"); SendClientMessage(playerid, COLOR_RED, string); return 1; } } } else { format(string, sizeof(string), "ERROR: You aren't at drugs unload place."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: Drug stock full!!"); SendClientMessage(playerid, COLOR_RED, string); return 1; } } else { format(string, sizeof(string), "ERROR: You are not in a car."); SendClientMessage(playerid, COLOR_RED, string); return 1; } } return 1; } //---------------------------------[CARINFO]------------------------------------------------------- if(strcmp(cmd, "/carinfo", true) == 0) { new tmpcar = GetPlayerVehicleID(playerid); if (IsPlayerInAnyVehicle(playerid)) { if(IsPlayerConnected(playerid)) { SendClientMessage(playerid,COLOR_RED,"----------[CAR INFO]---------"); format(string, sizeof(string), " Drugs: [%d]",PlayerHaul[tmpcar][pDrugsx]); SendClientMessage(playerid, COLOR_GREEN, string); format(string, sizeof(string), " Guns: [%d]",PlayerHaul[tmpcar][pGunsx]); SendClientMessage(playerid, COLOR_BLUE, string); SendClientMessage(playerid,COLOR_WHITE," Alchool: [not yet maded]"); SendClientMessage(playerid,COLOR_WHITE," Stuffs: [not yet maded]"); SendClientMessage(playerid,COLOR_RED,"-----------------------------"); } } else { format(string, sizeof(string), "ERROR: You are not in a car."); SendClientMessage(playerid, COLOR_RED, string); return 1; } return 1; } //---------------------------------------------------------------------------------------------
Код:
public SaveStocks() { new coordsstring[256]; format(coordsstring, sizeof(coordsstring), "%d,%d", Drugs, Guns); new File: file2 = fopen("stocks.ini", io_write); fwrite(file2, coordsstring); fclose(file2); return 1; }