SA-MP Forums Archive
Help Variable - 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: Help Variable (/showthread.php?tid=621065)



Help Variable - StreetRP - 06.11.2016

Hello !
I have a question ..
I'm going to creat a system of actor , and my actor are going to had MAX_REP reply of 128 caraters(dynamic IG )
how to creat the variable ?

Thanks

PHP код:
aRep[MAX_REP][128
?

Thanks you


Re: Help Variable - PeanutButter - 06.11.2016

I don't really understand what you mean with reply but try this:

#define MAX_REP 128 //PUT THIS ON TOP OF YOUR SCRIPT

Код:
new aRep[MAX_ACTORS][MAX_REP]



Re: Help Variable - StreetRP - 06.11.2016

No...
I have this enum
PHP код:
enum eActor {
    
aID,
    
aName[MAX_PLAYER_NAME],
    
aSkin,
    
Float:aPos[4],
    
aWorld,
    
aReply[MAX_REP],
     
aAnim 
}; 
So for example .. If I got next to an actor , it will say me a reply random
exemple :
"Hello"
"My name is X"
"see you soon"
When I have to save those 3 reply ?

Thanks


Re: Help Variable - PeanutButter - 06.11.2016

Put this on top of your script:
Код:
#define MAX_REP 10 // The max amount of replies an actor can have. You can change this.
This is what your enum should look like:
Код:
enum eActor { 
    aID, 
    aName[MAX_PLAYER_NAME], 
    aSkin, 
    Float:aPos[4], 
    aWorld, 
    aReply[MAX_REP], 
     aAnim  
};

new Actors[MAX_ACTORS][eActor];
The string can be accessed by this: Actors[id of the actor][aReply][number of the actor's reply]

Example:
Код:
format(Actors[0][aReply][0], 128, "Welcome");
format(Actors[0][aReply][1], 128, "My name is Steve and I'm an actor with id 0");
format(Actors[0][aReply][2], 128, "This is my 3th reply");

new actormsg[128];
format(actormsg, sizeof(actormsg), "%s: %s", Actors[0][aName], Actors[0][aReply][0]);
SendClientMessage(playerid, -1, actormsg);



Re: Help Variable - StreetRP - 06.11.2016

Thanks a lot !