12.01.2012, 16:27
In my script I get errors when trying to make zones, and when you are in a zone it'll TextDrawString' a textdraw showing the location name.
ERRORS:
ERRORS:
Код:
C:\Users\machine\Desktop\PCRPbeta\gamemodes\FCRP.pwn(514) : error 028: invalid subscript (not an array or too many subscripts): "ZoneText" C:\Users\machine\Desktop\PCRPbeta\gamemodes\FCRP.pwn(514) : warning 215: expression has no effect C:\Users\machine\Desktop\PCRPbeta\gamemodes\FCRP.pwn(514) : error 001: expected token: ";", but found "]" C:\Users\machine\Desktop\PCRPbeta\gamemodes\FCRP.pwn(514) : error 029: invalid expression, assumed zero C:\Users\machine\Desktop\PCRPbeta\gamemodes\FCRP.pwn(514) : fatal error 107: too many error messages on one line
pawn Код:
public update_zones() {
new line1[10];
new line2[10];
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && zoneupdates[i] == 1) {
if(IsPlayerInZone(i,player_zone[i])) { }
else {
new player_zone_before;
player_zone_before = player_zone[i];
player_zone[i] = -1;
for(new j=0; j<sizeof(zones);j++) {
if(IsPlayerInZone(i,j) && player_zone[i] == -1) {
if(player_zone_before == -1){
//GameTextForPlayer(i,zones[j][zone_name],1500,1);
// TEXTDRAW
// TextDrawShowForPlayer(i,ZoneText[i]);
TextDrawSetString(ZoneText[i], zones[j][zone_name]); // - errors
// END
}
else if(strcmp(zones[j][zone_name],zones[player_zone_before][zone_name],true) != 0){
//GameTextForPlayer(i,zones[j][zone_name],1500,1);
// TEXTDRAW
//TextDrawShowForPlayer(i,ZoneText[i]);
TextDrawSetString(ZoneText[i], zones[j][zone_name]);
// END
}
player_zone[i] = j;
format(line1,10,"p%dzone",i);
format(line2,10,"%d",j);
PropertySet(line1,line2);
}
}
if(player_zone[i] == -1) player_zone[i] = player_zone_before;
}
}
}
}
IsPlayerInZone(playerid, zoneid) {
if(zoneid == -1) return 0;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
if(x >= zones[zoneid][zone_minx] && x < zones[zoneid][zone_maxx]
&& y >= zones[zoneid][zone_miny] && y < zones[zoneid][zone_maxy]
&& z >= zones[zoneid][zone_minz] && z < zones[zoneid][zone_maxz]
&& z < 900.0) return 1;
return 0;
}