SA-MP Forums Archive
need help with freeze and unfrezze with sscanf+zcmd. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: need help with freeze and unfrezze with sscanf+zcmd. (/showthread.php?tid=410099)



need help with freeze and unfrezze with sscanf+zcmd. - mittukuttan - 24.01.2013

with sscanf+zcmd plz.


Re: need help with freeze and unfrezze with sscanf+zcmd. - antonio112 - 24.01.2013

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;
}