COMMAND:afk(playerid, params[]) { SendAdminText(playerid, "/afk", params); if (APlayerData[playerid][LoggedIn] == false) return 0; new Name[24], string[128], AFKName[25]; TogglePlayerControllable(playerid,0); GetPlayerName(playerid, Name, sizeof(Name)); GetPlayerName(playerid, AFKName, sizeof(AFKName)); format(string, sizeof(string),"%s[afk]", AFKName); SetPlayerName(playerid, string); format(string, sizeof(string),"Le joueur %s c'est mis afk !", Name); SendClientMessageToAll(0xFFFFFF, string); // message afk SendClientMessage(playerid,0xFFFFFFFF, "Vous etes maintenant afk !"); return 1; } COMMAND:stopafk(playerid, params[]) { SendAdminText(playerid, "/stopafk", params); if (APlayerData[playerid][LoggedIn] == false) return 0; new Name[24], string[128], AFKName[25]; TogglePlayerControllable(playerid,1); GetPlayerName(playerid, Name, sizeof(Name)); GetPlayerName(playerid, AFKName, sizeof(AFKName)); format(string, sizeof(string),"%s", AFKName); SetPlayerName(playerid, string); format(string, sizeof(string),"Le joueur %s est de retour !", Name); SendClientMessageToAll(0xFFFFFF, string); // message afk SendClientMessage(playerid,0xFFFFFFFF, "Vous etes maintenant de retour !"); return 1; }
SetPVarString(playerid, "AFKName", Name);
new name[24];
GetPVarString(playerid, "AFKName", name, sizeof(name));
SetPlayerName(playerid, name);
DeletePVar(playerid, "AFKName");
// for origin name
new NameOriginAfk[MAX_PLAYERS][MAX_PLAYER_NAME];
// for origin name
COMMAND:afk(playerid, params[])
{
SendAdminText(playerid, "/afk", params);
if (APlayerData[playerid][LoggedIn] == false) return 0;
new Name[24], string[128], AFKName[25];
TogglePlayerControllable(playerid,0);
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(playerid, AFKName, sizeof(AFKName));
format(string, sizeof(string),"%s[afk]", AFKName);
SetPlayerName(playerid, string);
format(string, sizeof(string),"Le joueur %s c'est mis afk !", Name);
SendClientMessageToAll(0xFFFFFF, string);
// message afk
SendClientMessage(playerid,0xFFFFFFFF, "Vous etes maintenant afk !");
return 1;
}
COMMAND:stopafk(playerid, params[])
{
SendAdminText(playerid, "/stopafk", params);
if (APlayerData[playerid][LoggedIn] == false) return 0;
new Name[24], string[128], AFKName[25];
TogglePlayerControllable(playerid,1);
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(playerid, AFKName, sizeof(AFKName));
format(string, sizeof(string),"%s", AFKName);
SetPlayerName(playerid, NameOriginAfk);
format(string, sizeof(string),"Le joueur %s est de retour !", Name);
SendClientMessageToAll(0xFFFFFF, string);
// message afk
SendClientMessage(playerid,0xFFFFFFFF, "Vous etes maintenant de retour !");
return 1;
}
C:\Users\XXXX\Desktop\Serveur SAMP\gamemodes\XXX.pwn(17982) : error 048: array dimensions do not match
new AFKName[25];
GetPlayerName(playerid, AFKName, sizeof AFKName);
AFKName[strlen(a) - 5] = EOS;
// or
strmid(AFKName, AFKName, 0, strlen(AFKName) - 5, sizeof AFKName);
PHP код:
Код:
C:\Users\XXXX\Desktop\Serveur SAMP\gamemodes\XXX.pwn(17982) : error 048: array dimensions do not match |
COMMAND:afk(playerid, params[])
{
SendAdminText(playerid, "/afk", params);
if (APlayerData[playerid][LoggedIn] == false) return 0;
if (GetPVarInt(playerid, "AFK") == 1)
return SendClientMessage(playerid, -1, "You are already AFK!");
new Name[24], string[128];
TogglePlayerControllable(playerid,0);
GetPlayerName(playerid, Name, sizeof(Name));
SetPVarString(playerid, "PreviousName", Name);
SetPVarInt(playerid, "AFK", 1); // To indicate that the player is AFK
format(string, sizeof(string), "%s[AFK]", Name);
SetPlayerName(playerid, string);
format(string, sizeof(string), "Le joueur %s c'est mis afk !", Name);
SendClientMessageToAll(-1, string);
// message afk
SendClientMessage(playerid, -1, "Vous etes maintenant afk !");
return 1;
}
COMMAND:stopafk(playerid, params[])
{
SendAdminText(playerid, "/stopafk", params);
if (APlayerData[playerid][LoggedIn] == false) return 0;
if (GetPVarInt(playerid, "AFK") == 0)
return SendClientMessage(playerid, -1, "You are not AFK!");
new Name[24], string[128];
TogglePlayerControllable(playerid, 1);
GetPVarString(playerid, "PreviousName", Name, sizeof(Name));
SetPlayerName(playerid, Name);
format(string, sizeof(string),"Le joueur %s est de retour !", Name);
SendClientMessageToAll(-1, string);
// message afk
SendClientMessage(playerid,-1, "Vous etes maintenant de retour !");
DeletePVar(playerid, "PreviousName");
SetPVarInt(playerid, "AFK", 0);
return 1;
}
So you want to remove the [afk] tag? strmid to extract characters or set the NULL for the string:
pawn Код:
|