My Gamemode Warnings (Zones problem)
#1

Hi everyone, I have a CNR Gamemode (San Andreas), I have zones problem and I fixed error, and now the remaining is warnings.

Quote:

C:\Users\USER\Desktop\SKCNR San Francisco 2013\SKCNR SAN ANDREAS SERVER\SERVERSKCNR\gamemodes\CNR.pwn(10987) : warning 202: number of arguments does not match definition
C:\Users\USER\Desktop\SKCNR San Francisco 2013\SKCNR SAN ANDREAS SERVER\SERVERSKCNR\gamemodes\CNR.pwn(10989) : warning 213: tag mismatch
C:\Users\USER\Desktop\SKCNR San Francisco 2013\SKCNR SAN ANDREAS SERVER\SERVERSKCNR\gamemodes\CNR.pwn(10981) : warning 203: symbol is never used: "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Warnings.

The warnings comes from Zones Functions code I believe.

Код:
///////////////////////////
//    Zone Functions
//////////////////////////
 
stock IsPlayerInZone(playerid, zone[])
{
        new TmpZone[MAX_ZONE_NAME];
        GetPlayer3DZone(playerid, TmpZone, sizeof(TmpZone));
        for(new i = 0; i != sizeof(gSAZones); i++)
        {
                if(strfind(TmpZone, zone, true) != -1)
                        return 1;
        }
        return 0;
}
 
stock GetPlayer2DZone(playerid, zone[], len) //Credits to Cueball, Betamaster, Mabako, and Simon (for finetuning).
{
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        for(new i = 0; i != sizeof(gSAZones); i++ )
        {
                if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4])
                {
                    return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
                }
        }
        return 0;
}
 
stock GetPlayer3DZone(playerid, zone[], len) //Credits to Cueball, Betamaster, Mabako, and Simon (for finetuning).
{
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        for(new i = 0; i != sizeof(gSAZones); i++ )
        {
                if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4] && z >= gSAZones[i][SAZONE_AREA][2] && z <= gSAZones[i][SAZONE_AREA][5])
                {
                    return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
                }
        }
        return 0;
}
 
stock ReturnPlayerZone(playerid)
{
 new pz[128]; //128 is better unless its a long text.
 format(pz, sizeof(pz), "Unknown");
 for(new i; i < sizeof(gSAZones); i++) //If error happens, just write in the size.
 {
   if(IsPlayerInZone(i))
 {
  memcpy(pz, gSAZones[i][zone_name], 0, 108);
  break;
  }
}
 return pz;
}
 
stock GetPlayerZoneID(playerid)
{
        for(new i; i < sizeof(gSAZones); i++) {
                if(IsPlayerInZone(playerid, i)) return i;
                }
}
------
Код:
warning 202: number of arguments does not match definition: if(IsPlayerInZone(i))
warning 213: tag mismatch:  memcpy(pz, gSAZones[i][zone_name], 0, 108);
warning 203: symbol is never used: "playerid": stock ReturnPlayerZone(playerid)
Help!
Reply
#2

warning 202: number of arguments does not match definition: if(IsPlayerInZone(i))
Check the functions, it should be: IsPlayerInZone(playerid, zone[]) - Here you forgot the zone parameter

warning 213: tag mismatch: memcpy(pz, gSAZones[i][zone_name], 0, 10;
memcpy(dest[], const source[], index=0, numbytes, maxlength=sizeof dest) - Tag mismatch: This 'pz', is this a string or not?

warning 203: symbol is never used: "playerid": stock ReturnPlayerZone(playerid)
Just as it says, the parameter 'playerid' in ReturnPlayerZone hasn't been used it seems.
Jup, check this stock ReturnPlayerZone(playerid); it loops through all zones and is using thбt as a player id:
pawn Код:
stock ReturnPlayerZone(playerid)
{
 new pz[128]; //128 is better unless its a long text.
 format(pz, sizeof(pz), "Unknown");
 for(new i; i < sizeof(gSAZones); i++) //If error happens, just write in the size.
 {
   if(IsPlayerInZone(i))
 {
  memcpy(pz, gSAZones[i][zone_name], 0, 108);
  break;
  }
}
 return pz;
}
The IsPlayerInZone(i) should be IsPlayerInZone(playerid) - Then it will work as it should work, and then you won't have that warning anymore
Reply
#3

the warnings are fixed.
Reply
#4

Yes thank you anyway
Reply
#5

That's gooood
https://www.youtube.com/watch?v=qMuoFEi42oE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)