SA-MP Forums Archive
cmd help - 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: cmd help (/showthread.php?tid=620200)



cmd help - MrCesar - 27.10.2016

hello guys, I have this cmd:
Код:
CMD:makemegod(playerid, params[]){
if(IsPlayerAdmin(playerid))
{
	PlayerInfo[playerid][Admin] += 999999;
	PlayerInfo[playerid][Score] += 999999;
	SetPlayerScore(playerid, 999999);
}
else SendClientMessage(playerid, COLOR_SYS, "** You are not authorized to use this command. **");
return 1;
}
it compiles fine, but it doesn't save the values on the ini file, how do i have to save it?


Re: cmd help - Gotham - 27.10.2016

PHP код:
CMD:makemegod(playeridparams[]){
if(
IsPlayerAdmin(playerid))
{
    
PlayerInfo[playerid][Admin] += 999999;
    
PlayerInfo[playerid][Score] += 999999;
    
SetPlayerScore(playerid999999);
        new 
INI:File INI_Open(UserPath(playerid));
        
INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
        
INI_Close(File);
}
else 
SendClientMessage(playeridCOLOR_SYS"** You are not authorized to use this command. **");
return 
1;

done!


Re: cmd help - MrCesar - 27.10.2016

Quote:
Originally Posted by Gotham
Посмотреть сообщение
PHP код:
CMD:makemegod(playeridparams[]){
if(
IsPlayerAdmin(playerid))
{
    
PlayerInfo[playerid][Admin] += 999999;
    
PlayerInfo[playerid][Score] += 999999;
    
SetPlayerScore(playerid999999);
        new 
INI:File INI_Open(UserPath(playerid));
        
INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
        
INI_Close(File);
}
else 
SendClientMessage(playeridCOLOR_SYS"** You are not authorized to use this command. **");
return 
1;

done!
thanks! but when are the times i have to use this?
Код:
new INI:File = INI_Open(UserPath(playerid));
        INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
        INI_Close(File);
And why is it used for the score only and not for setting admin level?

p.s. how can i create a money cmd like that? to save the value?

thanks alot!


Respuesta: cmd help - Eloy - 27.10.2016

Код:
CMD:givemoney(playerid, params[])
{
   new string[128];
     if(!IsPlayerAdmin) return SendClientMessage(playerid, -1, "Not Logged Rcon Admin!");
     if(sscanf(params, "ud", params[0], params[1] )) return SendClientMessage(playerid, -1, "Use: /Givemoney [ID] [Money]");
    format(string, sizeof(string), "You have gived %d Money" , params[1]);
    SendClientMessage(playerid, -1, string);
    GivePlayerMoney(playerid, params[1]);
    return 1;
}



Re: Respuesta: cmd help - Dignity - 27.10.2016

You use INI_Open whenever you want the server to open the text file.

INI_Write to write into the file, quite self explanatory. This can only be done after you have opened the file.

INI_Close to release the file from the server. Should be done after you finish emitting data into the file.

Quote:
Originally Posted by Eloy
Посмотреть сообщение
CMD:givemoney(playerid, params[])
{

}
What a useless post. You're the reason I wish negative reputation still existed.


Respuesta: cmd help - Eloy - 27.10.2016

Sorry, Sended message pressed Bar space in my keyboard