SA-MP Forums Archive
How to save text? - 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: How to save text? (/showthread.php?tid=581207)



How to save text? - Lajko1 - 11.07.2015

What I want to do is for example if I will do /makewanted (id) (reason) it will give police wanted start to player (I can do that command) but what I want from here if I will write /wanted it will display players with crimes? and which crime they've commit? I want this (reason) thingy to be saved and loaded I'm using yini


Re: How to save text? - Moudix - 11.07.2015

PHP код:
dcmd_wanted(playerid,params[])
{
    
#pragma unused params
    
if(AccInfo[playerid][LoggedIn] == 1)
    {
        if(
AccInfo[playerid][Level] >= 2)
        {
            new
                
InWanted,
                
string[64],
                
playername[MAX_PLAYER_NAME],
                
pWanted;
                
            for(new 
i=0;i<MAX_PLAYERS;i++)
            {
                if(
IsPlayerConnected(i) && GetPlayerWantedLevel(i) >= 1)
                {
                    if(
InWanted == 0)
                    {
                            
SendClientMessage(playeridyellow"___________ |- Wanted Players (List) -| ___________");
                          
InWanted 1;
                    }
                    
pWanted GetPlayerWantedLevel(i);
                    
GetPlayerName(iplayernamesizeof(playername));
                    
format(stringsizeof(string), "Player: %s(%d) - Wanted Level: %d"playername,ipWanted);
                     
SendClientMessage(playerid0xD9954EAAstring);
                  }
               }
            if(
InWanted == 0)
            {
                
SendClientMessage(playeridred"|-No players have WantedLevel! -|");
                }
                return 
1;
           }
           else return 
ErrorMessages(playerid1);
    }
    else return 
SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");

Took it from my admin system , change if(AccInfo[playerid][Level] >= 2) to if IsPlayerCop or whatever you are using.


Re: How to save text? - Lajko1 - 11.07.2015

Thank you +rep for fast response, but as I mentioned also do you know how to save crime reason?
For example /makewanted (id) Possession of illegal firearm
and than if i do /checkwanted (id) it will display me all charges that player has?


Re: How to save text? - Moudix - 11.07.2015

PHP код:
new
    
Wanted_ReasonMAX_PLAYERS ][ 48 ]
;
// OnPlayerConnect:
Wanted_Reasonplayerid ][ ] = EOS;
// When you set the wanted to 0, reset the reason like in OnPlayerConnect.
COMMAND:makewanted(playeridparams[])
{
    if(!
IsPlayerFED(playerid) && GetAdminLevel(playerid) < 6) return SendClientError(playeridCANT_USE_CMD);
    new 
iPlayeriLeveliReason48 ];
    if( 
sscanf params"uds[48]"iPlayeriLeveliReason))  return SCP(playerid"[PlayerID/PartOfName] [level] [reason]");
    if(
iLevel || iLevel 6) return SendClientError(playerid"Invalid level. Valid: 1-6");
    
format(iStrsizeof(iStr), " HQ: All units APB on %s,"RPName(iPlayer));
    
SendClientMessageToTeamPlayerInfo[playerid][playerteam], iStrCOLOR_PLAYER_SPECIALBLUE);
    
format(iStrsizeof(iStr), " HQ: Wanted for %s, category %d wanted suspect."iReasoniLevel);
    
SendClientMessageToTeamPlayerInfo[playerid][playerteam], iStrCOLOR_PLAYER_SPECIALBLUE);
    
SetPlayerWantedLevel(iPlayeriLevel);
    
strcpyWanted_Reasonplayerid ], iReason48 );
    return 
1;
}
COMMAND:wantedlist(playeridparams[])
{
    if(!
IsPlayerFED(playerid) && !GetAdminLevel(playerid)) return SendClientError(playeridCANT_USE_CMD);
    
PlayerLoop(i)
    {
        
SendClientMessage(playeridCOLOR_RED,"===============[WANTED LIST]===============");
        
format(iStr,sizeof(iStr),"%s %d stars, Wanted for: %s",RPName(i),GetPlayerWantedLevel(i), Wanted_Reason]);
        if(
GetPlayerWantedLevel(i)>=5SendClientMessage(playerid,COLOR_RED,iStr);
        if(
GetPlayerWantedLevel(i)<&& GetPlayerWantedLevel(i)>=2SendClientMessage(playerid,COLOR_ORANGE,iStr);
        if(
GetPlayerWantedLevel(i)<&& GetPlayerWantedLevel(i)>0SendClientMessage(playerid,COLOR_PLAYER_DARKYELLOW,iStr);
        
SendClientMessage(playeridCOLOR_RED,"===========================================");
    }
    return 
1;

I guess some of this codes may help you with what you want