Printing variables
#1

Код:
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?
Reply
#2

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
Reply
#3

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

Quote:

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

https://sampwiki.blast.hk/wiki/GameTextForPlayer
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)