SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/07/2020, 09:30 AM   #1
faustowp
Little Clucker
 
Join Date: Aug 2017
Posts: 26
Reputation: 0
Default argument type mismatch (argument 2)

Lines:

Code:
public SpeedoUpdate()
{
        for(new i = 0; i<MAX_PLAYERS; i++)
        {
                new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
                new veh = GetPlayerVehicleID(i);
                GetVehicleVelocity(veh, speed_x, speed_y, speed_z);
                final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*120.0;
                final_speed_int = floatround(final_speed,floatround_round);
                new kmh_anzahl = final_speed_int;
                new kmh[10],zustand[30],tank[10];
                format(kmh, 10,"KM/H: %d", kmh_anzahl);
                new Float:hp;
                GetVehicleHealth(GetPlayerVehicleID(i), hp);
                /*if(hp > 700){format(zustand, 30,"Estado: ~g~%.0f", hp);}
                if(hp < 700){format(zustand, 30,"Estado: ~y~%.0f", hp);}
                if(hp < 350){format(zustand, 30,"Estado: ~r~%.0f", hp);}
                if(hp < 250){format(zustand, 30,"Estado: ~r~%s", "BOOM");}*/
                format(tank, 10,"Gas: %d", VehicleFuel[veh]);
                PlayerTextDrawSetString(Tacho_KMH[i], kmh);
                PlayerTextDrawSetString(Tacho_Zustand[i], zustand);
                PlayerTextDrawSetString(Tacho_Tank[i], tank);

        }
        return 1;
}
faustowp is offline   Reply With Quote
Old 01/07/2020, 09:50 AM   #2
SharpenBlade
Big Clucker
 
Join Date: May 2020
Posts: 175
Reputation: 23
Default Re: argument type mismatch (argument 2)

This:
PHP Code:
PlayerTextDrawSetString(Tacho_KMH[i], kmh);
PlayerTextDrawSetString(Tacho_Zustand[i], zustand);
PlayerTextDrawSetString(Tacho_Tank[i], tank); 
should be:
PHP Code:
PlayerTextDrawSetString(playeridTacho_KMH[i], kmh);
PlayerTextDrawSetString(playeridTacho_Zustand[i], zustand);
PlayerTextDrawSetString(playeridTacho_Tank[i], tank); 
SharpenBlade is offline   Reply With Quote
Old 01/07/2020, 09:54 AM   #3
faustowp
Little Clucker
 
Join Date: Aug 2017
Posts: 26
Reputation: 0
Default Re: argument type mismatch (argument 2)

I tried that, but undefined symbol playerid
faustowp is offline   Reply With Quote
Old 01/07/2020, 10:02 AM   #4
Lexless
Little Clucker
 
Join Date: May 2020
Posts: 24
Reputation: 12
Default Re: argument type mismatch (argument 2)

pawn Code:
public SpeedoUpdate()
{
        for(new i = 0; i<MAX_PLAYERS; i++)
        {
                new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
                new veh = GetPlayerVehicleID(i);
                GetVehicleVelocity(veh, speed_x, speed_y, speed_z);
                final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*120.0;
                final_speed_int = floatround(final_speed,floatround_round);
                new kmh_anzahl = final_speed_int;
                new kmh[10],zustand[30],tank[10];
                format(kmh, 10,"KM/H: %d", kmh_anzahl);
                new Float:hp;
                GetVehicleHealth(GetPlayerVehicleID(i), hp);
                /*if(hp > 700){format(zustand, 30,"Estado: ~g~%.0f", hp);}
                if(hp < 700){format(zustand, 30,"Estado: ~y~%.0f", hp);}
                if(hp < 350){format(zustand, 30,"Estado: ~r~%.0f", hp);}
                if(hp < 250){format(zustand, 30,"Estado: ~r~%s", "BOOM");}*/

                format(tank, 10,"Gas: %d", VehicleFuel[veh]);
                PlayerTextDrawSetString(i, Tacho_KMH[i], kmh);
                PlayerTextDrawSetString(i, Tacho_Zustand[i], zustand);
                PlayerTextDrawSetString(i, Tacho_Tank[i], tank);

        }
        return 1;
}

Try it.
Lexless is offline   Reply With Quote
Old 01/07/2020, 10:03 AM   #5
SharpenBlade
Big Clucker
 
Join Date: May 2020
Posts: 175
Reputation: 23
Default Re: argument type mismatch (argument 2)

Quote:
Originally Posted by faustowp View Post
I tried that, but undefined symbol playerid
Replace playerid with i. You have a reply above. You are looping trough all players so use i. Also, I suggest using foreach.
SharpenBlade is offline   Reply With Quote
Old 01/07/2020, 10:08 AM   #6
faustowp
Little Clucker
 
Join Date: Aug 2017
Posts: 26
Reputation: 0
Default Re: argument type mismatch (argument 2)

Uy I missed that, solved thanks! I think I need to get some sleep haha
faustowp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 035: argument type mismatch (argument 1)/(argument 2) DavidGravelli Scripting Help 3 08/03/2019 11:42 AM
D:\server\gamemodes\ExtremeGame.pwn(22326) : error 035: argument type mismatch (argument 2) enzulikeS Scripting Help 2 25/04/2018 03:38 PM
[Ajuda] Ajuda para resolver argument type mismatch(argument 1) Infiniteplay Português/Portuguese 12 01/03/2015 08:01 AM
C:\Users\Lirbo\Desktop\Roleplay\gamemodes\ERP.pwn( 19) : error 035: argument type mismatch (argument 1) Lirbo Scripting Help 2 12/12/2014 02:51 PM
error 35: Argument Type Mismatch (argument 2) Forbidden Name System Stoyanov Scripting Help 2 01/11/2014 08:50 PM


All times are GMT. The time now is 05:37 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.