SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/07/2014, 04:31 PM   #1
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,100
Reputation: 40
Default Getting all characters one by one

Just out of curiosity..
If I would want to make a command, lets say /riddle [riddle text].
Would it be possible to make it show each character one by one?

For example: /riddle car
And it will say something like "First character is: C"
then maybe make some timer and after couple of seconds it say "Second character is: A" and again after some seconds it say "Third character is: R".
Is that possible and if yes, how would I do it?
Don_Cage is offline   Reply With Quote
Old 25/07/2014, 04:33 PM   #2
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,499
Reputation: 439
Default Re: Getting all characters one by one

Use timers/strings to your advantage. Separate the string, and set timers, etc.
Abagail is offline   Reply With Quote
Old 25/07/2014, 04:42 PM   #3
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,100
Reputation: 40
Default Re: Getting all characters one by one

How do I seperate the string?
Please show an example
Don_Cage is offline   Reply With Quote
Old 25/07/2014, 05:22 PM   #4
Champ
Gangsta
 
Champ's Avatar
 
Join Date: Sep 2011
Location: Pαкιѕтαи
Posts: 769
Reputation: 43
Default Re: Getting all characters one by one

There is a stock of "split" in wiki.

pawn Code:
// Author unknown. It was probably someone smart like [[User:DracoBlue|DracoBlue]] or [[User:Y_Less|Y_Less]].
stock split(const strsrc[], strdest[][], delimiter)
{
    new i, li;
    new aNum;
    new len;
    while(i <= strlen(strsrc))
    {
        if(strsrc[i] == delimiter || i == strlen(strsrc))
        {
            len = strmid(strdest[aNum], strsrc, li, i, 128);
            strdest[aNum][len] = 0;
            li = i+1;
            aNum++;
        }
        i++;
    }
    return 1;
}

check this out for usage:
http://wiki.sa-mp.com/wiki/Code_Snippets
Champ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Characters ZPolizei Bug Reports 1 09/07/2013 06:34 PM
/ad characters kidor Scripting Help 11 09/03/2012 09:20 PM
How to know how many characters name has ||123|| Help Archive 2 25/06/2011 11:03 AM
Max name characters is ... 20? Fedee! Help Archive 8 02/03/2010 10:33 PM
[JUST ASKING]Characters Mac_Rulez Help Archive 8 07/10/2009 12:33 AM


All times are GMT. The time now is 05:32 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.