problem on GetPlayer3DZone function
#1

PHP код:
stock GetPlayer3DZone(playerid)
{
new 
zone[32] = "San Andreas";
new 
Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new 
i = 0; i < sizeof(SanAndreasZones); i++)
{
if(
x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3]
&& 
y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4]
&& 
z >= SanAndreasZones[i][Zone_Area][2] && z <= SanAndreasZones[i][Zone_Area][5])
{
strcpy(zone, sizeof(zone), SanAndreasZones[i][Zone_Name]);
return 
zone;
}
}
return 
zone;
} 
Error:
PHP код:
error 035: argument type mismatch (argument 2)
On this line: strcpy(zone, sizeof(zone), SanAndreasZones[i][Zone_Name]); 
Reply
#2

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),);
Reply
#3

this the codes:
PHP код:
forward Speedometer();
public 
Speedometer()
{
new 
vehicleid, Float:health;
new 
engine, lights, alarm, doors, bonnet, boot, objective;
new 
fstring[32], string[512];
foreach(
Player, i)
{
if(
IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
vehicleid = GetPlayerVehicleID(i);
GetVehicleHealth(vehicleid, health);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            
string = "~b~~h~vehicle: ~w~";
            
strcat(string, VehicleNames[GetVehicleModel(vehicleid)-400], sizeof(string));
            
strcat(string, "~n~~b~~h~gps: ~w~", sizeof(string));
            
strcat(string, GetPlayer3DZone(i), sizeof(string));
            
strcat(string, "~n~~b~~h~health: ~g~", sizeof(string));
            
fstring = "iiiiiiiiii";
            if(
health > 1000.0) strins(fstring, "~r~", 10, sizeof(fstring));
            else if(
health < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
            else 
strins(fstring, "~r~", floatround(health/100.0), sizeof(fstring));
            
strcat(string, fstring, sizeof(string));
            
strcat(string, "        ~b~~h~fuel: ~g~", sizeof(string));
            
fstring = "iiiiiiiiii";
            if(
Fuel[vehicleid] > 100.0) strins(fstring, "~r~", 10, sizeof(fstring));
            else if(
Fuel[vehicleid] < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
            else 
strins(fstring, "~r~", floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
            
strcat(string, fstring, sizeof(string));
            
strcat(string, "        ~b~~h~", sizeof(string));
            if(
GetPVarInt(i, "Speedo")) format(fstring,sizeof(fstring),"mph: ~w~%d", GetPlayerSpeed(i, false));
            else 
format(fstring,sizeof(fstring),"kph: ~w~%d", GetPlayerSpeed(i, true));
            
strcat(string, fstring, sizeof(string));
            
strcat(string, "~n~~b~~h~engine: ", sizeof(string));
            if(
engine == 1) strcat(string, "~g~on", sizeof(string));
            else 
strcat(string, "~r~off", sizeof(string));
            
strcat(string, "        ~b~~h~alarm: ", sizeof(string));
            if(
VehicleSecurity[vehicleid] == 1) strcat(string, "~g~on", sizeof(string));
            else 
strcat(string, "~r~off", sizeof(string));
            
strcat(string, "        ~b~~h~doors: ", sizeof(string));
            if(
doors == 1) strcat(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:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new 
i = 0; i < sizeof(SanAndreasZones); i++)
{
if(
x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3]
&& 
y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4]
&& 
z >= SanAndreasZones[i][Zone_Area][2] && z <= SanAndreasZones[i][Zone_Area][5])
{
strcpy(zone, sizeof(zone), SanAndreasZones[i][Zone_Name]);
return 
zone;
}
}
return 
zone;
} 
Reply
#4

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(zone, SanAndreasZones[i][Zone_Name], sizeof(zone)); 
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)