SA-MP Forums Archive
quick strings? and the error - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: quick strings? and the error (/showthread.php?tid=245804)



quick strings? and the error - Donya - 02.04.2011

pawn Код:
text[ strfind( text, "$ply" ) ] = Playername(GetClosestPlayer(playerid));
shouldn't this work?

pawn Код:
error 006: must be assigned to an array
if i'm wrong, can you show me how to do it.


Re: quick strings? and the error - -Rebel Son- - 02.04.2011

Show the whole command/function.


Re: quick strings? and the error - Donya - 02.04.2011

that is it, i want when you say "$ply" under onplayertext, it will format "$ply" to the closest players name. and id etc.


Re: quick strings? and the error - -Rebel Son- - 02.04.2011

new Text[10]; ? Not sure if Text is indexed'


Re: quick strings? and the error - Calgon - 02.04.2011

Strings aren't declared by '$,' this isn't PHP or PERL or any other languages that retain a similar syntax.

From what I understand, you have already formatted a string called 'ply' - am I right so far? Be more specific.


Re: quick strings? and the error - -Rebel Son- - 02.04.2011

That's what i was wondering calg00ne, as i stated above, im not sure if Text, Or anything is indexed.


Re: quick strings? and the error - Donya - 02.04.2011

i said under onplayertext

lemme try to explain better

Donya Types: "Hello $ply"

Output - Donya Says: "Hello Calg00ne"

(i will see myself type Hello $ply, but, it will send Hello Calg00ne to everyone else.)

because Calg00ne is the closest player to me, it formats $ply to The closest player to me.
the text parameter i posted above is being used in OnPlayerText(playerid, text[]);
Sorry if i used your name Calg00ne, i just needed an example

so basically, im trying to find all "$ply"'s in a text, and format them all to the closest player. I hope i explained fairly well now.


Re: quick strings? and the error - Donya - 02.04.2011

bump


Re: quick strings? and the error - Donya - 04.04.2011

bump2