SA-MP Forums Archive
problem on GetPlayer3DZone function - 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: problem on GetPlayer3DZone function (/showthread.php?tid=282247)



problem on GetPlayer3DZone function - NeyMar96 - 10.09.2011

PHP код:
stock GetPlayer3DZone(playerid)
{
new 
zone[32] = "San Andreas";
new 
Float:xFloat:yFloat:z;
GetPlayerPos(playeridxyz);
for(new 
0sizeof(SanAndreasZones); i++)
{
if(
>= SanAndreasZones[i][Zone_Area][0] && <= SanAndreasZones[i][Zone_Area][3]
&& 
>= SanAndreasZones[i][Zone_Area][1] && <= SanAndreasZones[i][Zone_Area][4]
&& 
>= SanAndreasZones[i][Zone_Area][2] && <= SanAndreasZones[i][Zone_Area][5])
{
strcpy(zonesizeof(zone), SanAndreasZones[i][Zone_Name]);
return 
zone;
}
}
return 
zone;

Error:
PHP код:
error 035argument type mismatch (argument 2)
On this linestrcpy(zonesizeof(zone), SanAndreasZones[i][Zone_Name]); 



Re: problem on GetPlayer3DZone function - =WoR=Varth - 10.09.2011

I don't know what is strcpy but perhaps:
pawn Код:
strcpy(zone, SanAndreasZones[i][Zone_Name] sizeof(zone),);
Or use strcat:
pawn Код:
strcat(zone, SanAndreasZones[i][Zone_Name] sizeof(zone),);



Re: problem on GetPlayer3DZone function - NeyMar96 - 10.09.2011

this the codes:
PHP код:
forward Speedometer();
public 
Speedometer()
{
new 
vehicleidFloat:health;
new 
enginelightsalarmdoorsbonnetbootobjective;
new 
fstring[32], string[512];
foreach(
Playeri)
{
if(
IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
vehicleid GetPlayerVehicleID(i);
GetVehicleHealth(vehicleidhealth);
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
            
string "~b~~h~vehicle: ~w~";
            
strcat(stringVehicleNames[GetVehicleModel(vehicleid)-400], sizeof(string));
            
strcat(string"~n~~b~~h~gps: ~w~"sizeof(string));
            
strcat(stringGetPlayer3DZone(i), sizeof(string));
            
strcat(string"~n~~b~~h~health: ~g~"sizeof(string));
            
fstring "iiiiiiiiii";
            if(
health 1000.0strins(fstring"~r~"10sizeof(fstring));
            else if(
health 0.0strins(fstring"~r~"0sizeof(fstring));
            else 
strins(fstring"~r~"floatround(health/100.0), sizeof(fstring));
            
strcat(stringfstringsizeof(string));
            
strcat(string"        ~b~~h~fuel: ~g~"sizeof(string));
            
fstring "iiiiiiiiii";
            if(
Fuel[vehicleid] > 100.0strins(fstring"~r~"10sizeof(fstring));
            else if(
Fuel[vehicleid] < 0.0strins(fstring"~r~"0sizeof(fstring));
            else 
strins(fstring"~r~"floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
            
strcat(stringfstringsizeof(string));
            
strcat(string"        ~b~~h~"sizeof(string));
            if(
GetPVarInt(i"Speedo")) format(fstring,sizeof(fstring),"mph: ~w~%d"GetPlayerSpeed(ifalse));
            else 
format(fstring,sizeof(fstring),"kph: ~w~%d"GetPlayerSpeed(itrue));
            
strcat(stringfstringsizeof(string));
            
strcat(string"~n~~b~~h~engine: "sizeof(string));
            if(
engine == 1strcat(string"~g~on"sizeof(string));
            else 
strcat(string"~r~off"sizeof(string));
            
strcat(string"        ~b~~h~alarm: "sizeof(string));
            if(
VehicleSecurity[vehicleid] == 1strcat(string"~g~on"sizeof(string));
            else 
strcat(string"~r~off"sizeof(string));
            
strcat(string"        ~b~~h~doors: "sizeof(string));
            if(
doors == 1strcat(string"~r~locked"sizeof(string));
            else 
strcat(string"~g~unlocked"sizeof(string));
            
TextDrawSetString(SpeedoText[i], string);
}
}
}
stock GetPlayer3DZone(playerid)
{
new 
zone[32] = "San Andreas";
new 
Float:xFloat:yFloat:z;
GetPlayerPos(playeridxyz);
for(new 
0sizeof(SanAndreasZones); i++)
{
if(
>= SanAndreasZones[i][Zone_Area][0] && <= SanAndreasZones[i][Zone_Area][3]
&& 
>= SanAndreasZones[i][Zone_Area][1] && <= SanAndreasZones[i][Zone_Area][4]
&& 
>= SanAndreasZones[i][Zone_Area][2] && <= SanAndreasZones[i][Zone_Area][5])
{
strcpy(zonesizeof(zone), SanAndreasZones[i][Zone_Name]);
return 
zone;
}
}
return 
zone;




Re: problem on GetPlayer3DZone function - =WoR=G4M3Ov3r - 10.09.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
I don't know what is strcpy but perhaps:
pawn Код:
strcpy(zone, SanAndreasZones[i][Zone_Name] sizeof(zone),);
Or use strcat:
pawn Код:
strcat(zone, SanAndreasZones[i][Zone_Name] sizeof(zone),);
I believe, Its like this.

PHP код:
strcpy(zoneSanAndreasZones[i][Zone_Name], sizeof(zone)); 



Re: problem on GetPlayer3DZone function - =WoR=Varth - 10.09.2011

Quote:
Originally Posted by G4M3Ov3r
Посмотреть сообщение
I believe, Its like this.

PHP код:
strcpy(zoneSanAndreasZones[i][Zone_Name], sizeof(zone)); 
lol missed comma (,) twice.