SA-MP Forums Archive
Printing variables - 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: Printing variables (/showthread.php?tid=392140)



Printing variables - Dennis_Smith - 12.11.2012

Код:
96	new plate = strdel(cmdtext,0,10);
97     	GameTextForPlayer(playerid,plate,8000,1);
Код:
(97) : error 035: argument type mismatch (argument 2)
(96) : warning 204: symbol is assigned a value that is never used: "plate"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I'm trying to cut out the first 10 slots of the cmdtext and print it in the gametext. One, will 'plate' equal all but the first 10 slots, and two, how do you print variables?


Re: Printing variables - Azazelo - 12.11.2012

Quote:

96 new plate[128] = strdel(cmdtext,0,10);
97 GameTextForPlayer(playerid,plate,8000,1);

and you print variables with :

Quote:

new string[128] = "This is string";
new number = 123456789 ;
new Float:f_loat = 15.23;
printf("%s,%i,%f",string,number,f_loat);
// in console window you see this
This is string,123456789,15.23

hope this help


Re: Printing variables - Dennis_Smith - 12.11.2012

Is there a way to print a variable in GameTextForPlayer ? (Assuming the variable is a string.)


Re: Printing variables - Azazelo - 12.11.2012

Quote:

new string[18];
format(string, sizeof(string), "Vehicle ID: %i", vehicleid);
GameTextForPlayer(playerid, string, 3000, 1);

https://sampwiki.blast.hk/wiki/GameTextForPlayer


Re: Printing variables - Dennis_Smith - 12.11.2012

I actually figured out a quicker way.

Код:
        strdel(cmdtext,0,10);
     	GameTextForPlayer(playerid,cmdtext,8000,1);
I delete part of the cmdtext variable, and it changes it for the rest of the function. So if i use the variable again, the first 10 letters have been removed. Thanks for the help by the way.