SA-MP Forums Archive
Long time didn't have no prob.. Please help + rep - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Long time didn't have no prob.. Please help + rep (/showthread.php?tid=327804)



Long time didn't have no prob.. Please help + rep - Scrillex - 22.03.2012

Код:
error 035: argument type mismatch (argument 2)
Код:
stock ReturnPlayerZone(playerid)
{
	new playerzone[256] = "Unknown";
	for(new j; j < sizeof(zones); j++)
	{
		if(IsPlayerInZone(playerid,j))//this line
		{
			memcpy(playerzone, zones[j][zone_name], 0, 108);
			break;
		}
	}
    return playerzone;
}



Re: Long time didn't have no prob.. Please help + rep - Scrillex - 22.03.2012

Please some one....


Re: Long time didn't have no prob.. Please help + rep - Twisted_Insane - 22.03.2012

You don't need the playerid there if you're already using the loop:

pawn Код:
if(IsPlayerInZone(j))



Re: Long time didn't have no prob.. Please help + rep - Vince - 22.03.2012

InPlayerInZone requires the zone name to be inputted as string. But why bother writing your own function if there's already one available?
pawn Код:
stock GetPlayer2DZone(playerid, zone[], len=sizeof zone) //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;
}