new pname;
GetPlayerName(playerid, pname, sizeof(pname));
if(pname == runner) return SendClientMessage(playerid, COLOR_RED, "You are not the runner!");
if(!strcmp(pname, "runner"))
{
Try this, using strcmp like Viniborn suggested:
pawn Код:
|
GetPlayerName(playerid, runner, sizeof(runner));
if(strcmp(pname,runner) == 0)
{
//player is runner
}
new runner[MAX_PLAYER_NAME];
CMD:start(playerid, params[])
{
if(!IsAdmin(playerid, 2)) return ErrorMsg(playerid);
{
if(Events == 0)
{
new string[254];
format(string, sizeof(string), "%s has started!", eventname);
SendClientMessageToAll(COLOR_GREY, string);
GetPlayerName(playerid, runner, sizeof(runner));
Started = 1;
}
}
return 1;
}
CMD:end(playerid, params[])
{
//Here I want to compare the runner who activated the Start command and the new player who tries to do /end.
/*GetPlayerName(playerid, pname, sizeof(pname));
if(strcmp(pname,runner) == 0) return SendClientMessage(playerid, COLOR_RED, "You are not the runner!");*/
if(!IsAdmin(playerid, 2)) return ErrorMsg(playerid);
{
new string[254];
format(string, sizeof(string), "%s has ended! You can no longer join.", eventname);
SendClientMessageToAll(COLOR_GREY, string);
Started = 0;
}
return 1;
}
CMD:end(playerid, params[])
{
new pname[24];
GetPlayerName(playerid, pname, sizeof(pname));
if(strcmp(pname,runner) != 0) // use != for "not the same"
return SendClientMessage(playerid, COLOR_RED, "You are not the runner!");
if(!IsAdmin(playerid, 2)) //if the player is not admin
return ErrorMsg(playerid);
new string[254];
format(string, sizeof(string), "%s has ended! You can no longer join.", eventname);
SendClientMessageToAll(COLOR_GREY, string);
Started = 0;
return 1;
}