Foreach & GetPlayerVehicleID
#1

Well because a timer didn't seem to work I made debug messages, and It seems like
it doesn't work to GetPlayerVehicleID inside a Foreach loop?

I get this error when I compile;
error 035: argument type mismatch (argument 1)
pawn Код:
foreach(Player,i)
    {
        print("Foreach");
        if(GetPlayerState(i)==PLAYER_STATE_DRIVER)
        {
            print("IfStateDriver");
            vehicleid = GetPlayerVehicleID(i);
            print(vehicleid); // here
Reply
#2

new vehicleid = GetPlayerVehicleID( i );
Reply
#3

That is the same code as I've written, only that i've made the variable above so i wouldn't create new variables everytime it loops.
Reply
#4

the function "print" has a string argument, not integer
Reply
#5

You're trying to simply print an integer, print() expects strings.

Use printf and format the printing:

pawn Код:
printf("vehicleid: %d", vehicleid);
Reply
#6

Quote:
Originally Posted by dice7
Посмотреть сообщение
the function "print" has a string argument, not integer
OK, but the thing is I have an If statement using this integer (vehicleid) and It isn't executed,
it bypasses that if statement. So I think it has to do with this.
Reply
#7

So change your code with the printf example I gave you and try debug again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)