18.11.2010, 14:57
Got a little problem here that I can't figure out.
Here's the error code:
The line is commented out
Here's the error code:
Quote:
error 033: array must be indexed (variable "name") |
Code:
if (!strcmp(cmdtext, "/lock", true, 5)) { new closestcar = GetClosestVehicle(playerid); if(IsPlayerInAnyVehicle(playerid) || GetDistanceToVehicle(playerid, closestcar) <= 10){ new file[128]; format(file, sizeof(file), SERVER_VEHICLE_FILE, closestcar); new Locked = dini_Int(file, "Locked"); new vehfaction = dini_Int(file, "Faction"); new vehowner = dini_Int(file, "Owner"); new name[MAX_PLAYER_NAME], usrfile[256]; GetPlayerName(playerid, name, sizeof(name)); format(usrfile, sizeof(usrfile), SERVER_USER_FILE, name); new Faction = dini_Int(usrfile, "Faction"); new AdminLevel = dini_Int(usrfile, "AdminLevel"); if(Faction == vehfaction || vehowner == name || AdminLevel >= 2){ // error is at this line, it says. new loccet; if(Locked == 2){ loccet = 1; SendClientMessage(playerid, WHITE, "Vehicle was locked" ); }else{ loccet = 0; SendClientMessage(playerid, WHITE, "Vehicle was unlocked" ); } for(new u = 0; u < MAX_PLAYERS; u++) { SetVehicleParamsForPlayer( closestcar, u, 0, loccet ); if(loccet == 1){ dini_IntSet(file, "Locked", 2); }else{ dini_IntSet(file, "Locked", 1); } } }else{ SendClientMessage(playerid, WHITE, "You may only lock a vehicle belonging to you or your faction." ); } }else{ SendClientMessage(playerid, WHITE, "You have to be in or near the vehicle you want to lock." ); }