/putnitro help
#3

?
pawn Код:
if(strcmp(cmd, "/putnitro", true) == 0)
{
    if(IsSpawned[playerid] == 0) {
        SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
        return 1;
    }
    if(InDerby[playerid] == 1) {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
        return 1;
    }
    if(gTeam[playerid] != TEAM_MECHANIC) {
        SendClientMessage(playerid,COLOR_ERROR,"You are not a Car Mechanic");
        return 1;
    }
    if(fixedcarrecent[playerid] >=1) {
        SendClientMessage(playerid,COLOR_ERROR,"Command used recently. Please wait");
        return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_ERROR, "USAGE: /putnitro (id)");
        return 1;
    }
    giveplayerid = strval(tmp);
    if(!IsNumeric(tmp)) {
        SendClientMessage(playerid, COLOR_ERROR, "USAGE: /putnitro (id) ID Must be a number");
        return 1;
    }
    if(!IsPlayerConnected(giveplayerid)) {
        format(szstring, sizeof(szstring), "ID (%d) is not an active player", giveplayerid);
        SendClientMessage(playerid, COLOR_ERROR, szstring);
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 5) {
        format(szstring, sizeof(szstring), "(%d) Is not close enough. You cannot add nitro to that players vehicle",giveplayerid);
        SendClientMessage(playerid, COLOR_ERROR, szstring);
        return 1;
    }
    GetPlayerName(playerid,mname, 24);
    GetPlayerName(giveplayerid, pname, 24);
    if(!IsPlayerInAnyVehicle(giveplayerid)) {
        format(szstring, sizeof(szstring), "%s(%d) is not in any vehicle",pname,giveplayerid);
        SendClientMessage(playerid, COLOR_ERROR, szstring);
        return 1;
    }
    new tempid = GetPlayerVehicleID(giveplayerid);
    if(!IsValidNosVehicle(tempid)) {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot add nitro to this vehicle!");
        return 1;
    }
    if(IsValidNosVehicle(tempid)) {
        AddVehicleComponent(tempid, 1009);
        new mrand = random(10000);
        oscore = GetPlayerScore(playerid);
        GivePlayerMoney(giveplayerid,-mrand);
        GivePlayerMoney(playerid,mrand);
        SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_NITRO ADDED_|");
        format(szstring, sizeof(szstring), "Mechanic %s(%d) has added nitro to your vehicle for $%d",mname,playerid,mrand);
        SendClientMessage(giveplayerid,COLOR_DODGERBLUE, szstring);
        SendClientMessage(playerid, 0xA9A9A9AA, "|_NITRO ADDED_|");
        format(szstring, sizeof(szstring), "You have added nitro to %s(%d)s vehicle. You earned $%d", pname,giveplayerid,mrand);
        SendClientMessage(playerid,COLOR_DODGERBLUE, szstring);
        SetPlayerScore(playerid, oscore +1);
        return 1;
    }
    else {
        format(szstring, sizeof(szstring), "%s(%d) is not the driver of the vehicle",pname,giveplayerid);
        SendClientMessage(giveplayerid,COLOR_DODGERBLUE, szstring);
    }
    return 1;
}
Reply


Messages In This Thread
/putnitro help - by MWF2 - 16.12.2010, 21:37
Re: /putnitro help - by WillyP - 16.12.2010, 21:39
Re: /putnitro help - by The_Gangstas - 16.12.2010, 21:40
Re: /putnitro help - by MWF2 - 16.12.2010, 21:49
Re: /putnitro help - by MWF2 - 16.12.2010, 21:50
Re: /putnitro help - by The_Gangstas - 16.12.2010, 22:07
Re: /putnitro help - by [XA]PuNi$HeR_ - 17.12.2010, 00:01
Re: /putnitro help - by MWF2 - 17.12.2010, 14:21
Re: /putnitro help - by Fool - 17.12.2010, 15:49
Re: /putnitro help - by WillyP - 17.12.2010, 16:44

Forum Jump:


Users browsing this thread: 2 Guest(s)