addscore or setscore command
#8

pawn Код:
#define FILTERSCRIPT
#include <a_samp>
// Defines
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000AA

#pragma tabsize 0

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("STRCMP Command");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" STRCMP Command");
    print("----------------------------------\n");
}

#endif

//public OnGameModeInit()
//{
    // Don't use these lines if it's a filterscript
    //SetGameModeText("Blank Script");
    //AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    //return 1;
//}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{      
    if (strcmp(cmdtext,"/cc", true , 10) == 0)//--- only use if neccesery
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        SendClientMessageToAll(COLOR_YELLOW," ");
        new string[64], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"Admin %s Has now Cleared The chat!.",pName);
        SendClientMessageToAll(COLOR_YELLOW,string);
        return 1;
    }
   
    if(strcmp(cmdtext, "/respawncars", true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
        new vh=CreateVehicle(400,0.0,0.0,0.0,0.0,-1,-1,-1);
        DestroyVehicle(vh);
        new p[MAX_VEHICLES];
        for(new v = 0; v < vh; v++)
        {
            p[v]=0;
            for(new i = 0; i < GetMaxPlayers(); i++)
            {
                if(IsPlayerInVehicle(i,v)) p[v]=1;
            }
            if(p[v]==0) SetVehicleToRespawn(v);
        }
        new string[64], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"Admin %s Has Respawned all Unused Cars!",pName);
        SendClientMessageToAll(COLOR_YELLOW,string);
        return 1;
    }
   
    if (strcmp("/playradio", cmdtext, true) == 0)
    {
        PlayAudioStreamForPlayer(playerid, "http://k006.kiwi6.com/hotlink/txcwk76rs1/bullets_-_sammy_adams.mp3");
        return 1;
    }
   
    if(strcmp(cmd, "/setscore", true) == 0)
    {
        new  tmp[20], cmd[50];
        new para1;
        tmp = strtok(cmdtext, idx);
        para1 = strval(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "Usage: /setscore [playerid] [Level]");
            return 1;
        }
        new level;
        tmp = strtok(cmdtext, idx);
        level = strval(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "Usage: /setscore [playerid] [Level]");
            return 1;
        }
        if (IsPlayerAdmin(playerid) == 1)
        {
            if(IsPlayerConnected(para1))
            {
                if(para1 != INVALID_PLAYER_ID)
                {
                    SetPlayerScore(para1, level);

                    format(string, sizeof(string), "[Server] You have set %s 's score to %d .", GetPlayerNameEx(para1),level);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

                    format(string, sizeof(string), "[Server] You have been set %d score by %s.", level,GetPlayerNameEx(playerid));
                    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                }
            }//not connected
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "Your not an administrator.");
        }
        return 1;
    }
    return 0;
}
Not compiled. Done through mobile.
Reply


Messages In This Thread
addscore or setscore command - by Patrick - 04.10.2012, 16:56
Re: addscore or setscore command - by Patrick - 04.10.2012, 17:06
Re: addscore or setscore command - by RedJohn - 04.10.2012, 17:11
Re: addscore or setscore command - by Patrick - 04.10.2012, 17:20
Re: addscore or setscore command - by Patrick - 04.10.2012, 17:34
Re: addscore or setscore command - by RedJohn - 04.10.2012, 17:56
Re: addscore or setscore command - by Patrick - 04.10.2012, 18:03
Re: addscore or setscore command - by RedJohn - 04.10.2012, 18:30
Re: addscore or setscore command - by Patrick - 04.10.2012, 19:56
Re: addscore or setscore command - by RedJohn - 04.10.2012, 22:39

Forum Jump:


Users browsing this thread: 5 Guest(s)