SA-MP Forums Archive
I think my code is wrong. - 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: I think my code is wrong. (/showthread.php?tid=488995)



I think my code is wrong. - EliteApple - 20.01.2014

I've been tweeking this alot over the past hour, I've did it before, but I'm not sure if this is the same code I was using.

pawn Код:
for(new carid = 0; carid < CARS; carid++)
{
    if(DynamicCars[carid][CarType] == 1)
    {
         new string[11];
         SetVehicleParamsForPlayer(carid, playerid, 1, 0);
         format(string, sizeof(string), "%d", carid);
         SendClientMessage(playerid, COLOR_WHITE);
     }
}
I'll rep, if you're 'in need' of it.


Re: I think my code is wrong. - Ari - 20.01.2014

What are you trying to achieve?

What is wrong with the code? Why is it 'wrong'? does it not work? does it crash your server? does it not compile, if so what's the error?


Re: I think my code is wrong. - EliteApple - 20.01.2014

It complies. It just doesn't work ingame.


Re: I think my code is wrong. - jessejanssen - 20.01.2014

Quote:
Originally Posted by EliteApple
Посмотреть сообщение
It complies. It just doesn't work ingame.
Does it send empty strings? (You could see with timestamp on. Else just put "> " in front of %d or something, then you're 100% sure.) Else it'll be in the if check, make sure 'DynamicCars[carid][CarType]' is actually 1 else it will indeed do nothing.

Best regards,
Jesse


Re: I think my code is wrong. - DeStunter - 20.01.2014

helps if you send the string
SendClientMessage(playerid, COLOR_WHITE);
SendClientMessage(playerid, COLOR_WHITE, string);


Re: I think my code is wrong. - jessejanssen - 20.01.2014

Quote:
Originally Posted by DeStunter
Посмотреть сообщение
helps if you send the string
SendClientMessage(playerid, COLOR_WHITE);
SendClientMessage(playerid, COLOR_WHITE, string);
OH LOL! I just read "SendClientMessage", never even check the params because that's too obvious :3...... Anyhow, can happen, nothing to worry about, alltough Pawno should give you a warning telling you that the parameters aren't right and that should be enough info to find out what's wrong. But hey, it's solved ..

Best regards,
Jesse


Re: I think my code is wrong. - EliteApple - 20.01.2014

Thats the thing, I don't even get that message. When I do indeed have 4 cars with type 1.



EDIT: Okay, now it sends me the vehicle IDs that are type 1, but still, type 1 vehicles do not get unlocked.