29.05.2010, 08:06
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256],Friend[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/addfriend", cmd, true, 10) == 0)
{
if(!strlen(tmp)) {
SendClientMessage(playerid,0xAFAFAFFF,"Usage: /AddFriend (id)");
return 1;
}
new id = strval(tmp);
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,0xAFAFAFFF,"/AddFriend : Bad player ID");
return 1;
}
if(playerid == id) {
SendClientMessage(playerid,0xAFAFAFFF,"You Cant be friends with yourself");
return 1;
}
if(!dini_Exists(Friend)) {
SendClientMessage(playerid,0xAFAFAFFF,"You Dont have a save file");
return 1;
}
new NAME[MAX_PLAYER_NAME],FriendName[MAX_PLAYER_NAME];
GetPlayerName(playerid, NAME, sizeof(NAME));
format(Friend, sizeof(Friend), "/FRIENDS/%s.txt", NAME);
GetPlayerName(id, FriendName, sizeof(FriendName));
dini_Set(Friend, "Friend1", FriendName);
return 1;
}
}
return 0;
}