need help with freeze and unfrezze with sscanf+zcmd.
#1

with sscanf+zcmd plz.
Reply
#2

pawn Код:
CMD:freeze(playerid, params[])
{
        new pName[MAX_PLAYER_NAME + 1], name[MAX_PLAYER_NAME + 1], 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: /freeze [PlayerID]");

    if(!IsPlayerConnected(pID))
        return SendClientMessage(playerid, -1, "Selected player is not connected.");

        GetPlayerName(playerid, pName, sizeof pName);
        GetPlayerName(pID, name, sizeof name);
        TogglePlayerControllable(pID, false);
    format(str, sizeof str, "Admin %s freezed you.", pName);
    SendClientMessage(pID, -1, str);
    format(str, sizeof str, "You freezed %s.", name);
    SendClientMessage(playerid, -1, str);
    format(str, sizeof str, "Admin %s freezed %s.", pName, name);
    SendClientMessageToAll(-1, str);
        return 1;
}
CMD:unfreeze(playerid, params[])
{
        new pName[MAX_PLAYER_NAME + 1], name[MAX_PLAYER_NAME + 1], 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: /unfreeze [PlayerID]");

    if(!IsPlayerConnected(pID))
        return SendClientMessage(playerid, -1, "Selected player is not connected.");

        GetPlayerName(playerid, pName, sizeof pName);
        GetPlayerName(pID, name, sizeof name);
        TogglePlayerControllable(pID, true);
    format(str, sizeof str, "Admin %s unfreezed you.", pName);
    SendClientMessage(pID, -1, str);
    format(str, sizeof str, "You unfreezed %s.", name);
    SendClientMessage(playerid, -1, str);
    format(str, sizeof str, "Admin %s unfreezed %s.", pName, name);
    SendClientMessageToAll(-1, str);
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)