07.02.2013, 23:35
Here my Code i Wanna to save the stat's on Helper's
Code:
COMMAND:sethelper(playerid, params[])
{
new pID, str[128];
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
if(sscanf(params,"u", pID))
return SendClientMessage(playerid,-1,"USAGE: /sethelper [PlayerID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "ERROR: Selected player is not connected.");
if(playerHelper[pID])
return SendClientMessage(playerid, -1, "Selected player is a helper already.");
new name[MAX_PLAYER_NAME+1], pName[MAX_PLAYER_NAME+1];
GetPlayerName(pID, name, sizeof name);
GetPlayerName(playerid, pName, sizeof pName);
playerHelper[pID] = true;
format(str, sizeof str, "Admin %s made you a helper.", pName);
SendClientMessage(pID, -1, str);
format(str, sizeof str, "You made %s a helper.", name);
SendClientMessage(playerid, -1, str);
// Let the server know that this was a valid command
return 1;
}
Code:
// This function will save all player-data (used when the player disconnects from the server)
PlayerFile_Save(playerid)
{
format(LineForFile, 100, "Helper %i\r\n", APlayerData[playerid][PlayerLevel]); // Construct the line: "Helper <playerlevel>"
fwrite(PFile, LineForFile); // And save it to the file
return 1;
}
Code:
if (strcmp(ParameterName, "Helper", false) == 0) // If the parametername is correct ("Level")
APlayerData[playerid][PlayerLevel] = strval(ParameterValue); // Store the playerlevel

