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(playerid, yellow, "___________ |- Wanted Players (List) -| ___________");
InWanted = 1;
}
pWanted = GetPlayerWantedLevel(i);
GetPlayerName(i, playername, sizeof(playername));
format(string, sizeof(string), "Player: %s(%d) - Wanted Level: %d", playername,i, pWanted);
SendClientMessage(playerid, 0xD9954EAA, string);
}
}
if(InWanted == 0)
{
SendClientMessage(playerid, red, "|-No players have WantedLevel! -|");
}
return 1;
}
else return ErrorMessages(playerid, 1);
}
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_Reason[ MAX_PLAYERS ][ 48 ]
;
// OnPlayerConnect:
Wanted_Reason[ playerid ][ 0 ] = EOS;
// When you set the wanted to 0, reset the reason like in OnPlayerConnect.
COMMAND:makewanted(playerid, params[])
{
if(!IsPlayerFED(playerid) && GetAdminLevel(playerid) < 6) return SendClientError(playerid, CANT_USE_CMD);
new iPlayer, iLevel, iReason[ 48 ];
if( sscanf ( params, "uds[48]", iPlayer, iLevel, iReason)) return SCP(playerid, "[PlayerID/PartOfName] [level] [reason]");
if(iLevel < 1 || iLevel > 6) return SendClientError(playerid, "Invalid level. Valid: 1-6");
format(iStr, sizeof(iStr), " HQ: All units APB on %s,", RPName(iPlayer));
SendClientMessageToTeam( PlayerInfo[playerid][playerteam], iStr, COLOR_PLAYER_SPECIALBLUE);
format(iStr, sizeof(iStr), " HQ: Wanted for %s, category %d wanted suspect.", iReason, iLevel);
SendClientMessageToTeam( PlayerInfo[playerid][playerteam], iStr, COLOR_PLAYER_SPECIALBLUE);
SetPlayerWantedLevel(iPlayer, iLevel);
strcpy( Wanted_Reason[ playerid ], iReason, 48 );
return 1;
}
COMMAND:wantedlist(playerid, params[])
{
if(!IsPlayerFED(playerid) && !GetAdminLevel(playerid)) return SendClientError(playerid, CANT_USE_CMD);
PlayerLoop(i)
{
SendClientMessage(playerid, COLOR_RED,"===============[WANTED LIST]===============");
format(iStr,sizeof(iStr),"%s %d stars, Wanted for: %s",RPName(i),GetPlayerWantedLevel(i), Wanted_Reason[ i ]);
if(GetPlayerWantedLevel(i)>=5) SendClientMessage(playerid,COLOR_RED,iStr);
if(GetPlayerWantedLevel(i)<5 && GetPlayerWantedLevel(i)>=2) SendClientMessage(playerid,COLOR_ORANGE,iStr);
if(GetPlayerWantedLevel(i)<2 && GetPlayerWantedLevel(i)>0) SendClientMessage(playerid,COLOR_PLAYER_DARKYELLOW,iStr);
SendClientMessage(playerid, COLOR_RED,"===========================================");
}
return 1;
}
I guess some of this codes may help you with what you want