Level system, reserved vehicles, ...
#4

Well if I had to make a payday system that paid per hour, I would have a constant timer checking the time to make sure it's not just paying per hour, but paying ON the hour.

pawn Код:
forward TimeUpdate();
public OnGameModeInit()
{
    SetTimer("TimeUpdate",60000,1); //every minute
    return 1;
}
public TimeUpdate()
{
    new hh,mm,ss;
    gettime(hh,mm,ss);
    if(mm==0)
    {
        for(new playerid;playerid<MAX_PLAYERS;playerid++)
        {
            if(!IsPlayerConnected(playerid))continue;
            GivePlayerMoney(playerid,5000);
        }
        new string[64];
        format(string,64,"The time is now %d:00, enjoy your payday!",hh);
        SendClientMessageToAll(0xFFFFFFFF,string);
    }
}
EDIT:

For faction only vehicles, you'll have to have a faction system already created, most (if not all) faction systems go by predefined factions with integers as IDs. I personally would much rather use strings to define the factions that way you can create one without having to establish it (just make a code concerning it)

pawn Код:
#define MAX_FACTION_NAME 16
new pFaction[MAX_PLAYERS][MAX_FACTION_NAME];
new pFactionRank[MAX_PLAYERS];
new vFaction[MAX_VEHICLES][MAX_FACTION_NAME];
new vFactionRank[MAX_VEHICLES];

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/SetFaction",true,11))
    {
        if(!IsPlayerAdmin(playerid))return 0;
        if(!cmdtext[13])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /SetFaction [playerid] [FullFactionName]");
        new space=strfind(cmdtext," ",true,13);
        if((space==-1)||!cmdtext[space+1])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /SetFaction [playerid] [FullFactionName]");
        space++;
        new player=strval(cmdtext[13]);
        if(!IsPlayerConnected(player))return SendClientMessage(playerid,0xFF0000FF,"Player Not Found");
        pFaction[player]=cmdtext[space];
        new tmp[32];
        format(tmp,32,"Player %d set to faction \"%s\"",player,cmdtext[space]);
        SendClientMessage(playerid,0xFF0000FF,tmp);
        return 1;
    }

    if(!strcmp(cmdtext,"/setvehiclefaction",true,18))
    {
        if(!IsPlayerAdmin(playerid))return 0;
        if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not in a vehicle!");
        if(!cmdtext[20])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /SetVehicleFaction [FullFactionName]");
        vFaction[GetPlayerVehicleID(playerid)]=cmdtext[20];
        new tmp[32];
        format(tmp,32,"Vehicle %d set to faction \"%s\"",GetPlayerVehicleID(playerid),cmdtext[20]);
        SendClientMessage(playerid,0xFF0000FF,tmp);
        return 1;
    }
    return 0;
}

//Lock vehicles that have a faction name against players who don't match factions
public OnVehicleStreamIn(vehicleid,forplayerid)
{
    if(vFaction[vehicleid][0]&&!strcmp(vFaction[vehicleid],pFaction[playerid],true))SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
}
This is kind of a REALLY mini faction script


None of this code has been tested or compiled
Reply


Messages In This Thread
Level system, reserved vehicles, ... - by Tetsuka - 27.12.2010, 11:52
Re: Level system, reserved vehicles, ... - by Crime Life ROLEPLAY - 27.12.2010, 12:08
Re: Level system, reserved vehicles, ... - by __ - 27.12.2010, 12:14
Re: Level system, reserved vehicles, ... - by Joe Staff - 27.12.2010, 13:57
Re: Level system, reserved vehicles, ... - by Tetsuka - 27.12.2010, 16:11

Forum Jump:


Users browsing this thread: 1 Guest(s)