All pastes #483053 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-05-11 15:25 UTC
rendered paste body
if(strcmp(cmd, "/cunbuy", true) == 0) {		new var1[256];		new filename[256];		format(filename, sizeof(filename), "%d", GetPlayerVehicleID(playerid));		GetPlayerName(playerid, playername, MAX_PLAYER_NAME);   	    var1 = dini_Get(filename, "owner");   	    carbuyable[playerid] = dini_Int(filename, "buybar");   	    if(logged[playerid] == 0) {			SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be registered and logged in to use this command!");			return 1;		}		if(passenger[playerid] == 1) {			SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be in the drivers seat to use this command");			return 1;		}		if(IsPlayerInAnyVehicle(playerid) == 0) {			SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be in a vehicle in order to use this command");			return 1;		}		if(carbuyable[playerid] == 1) {		    SendClientMessage(playerid, COLOR_BRIGHTRED, "This vehicle is already set as un-buyable!");			return 1;		}   	    if (PlayerInfo[playerid][pAdmin] == 2) {   	        if (strcmp(server,var1,false) == 0) { 				SendClientMessage(playerid, COLOR_ORANGE, "You have set this vehicle to non-buyable!");   				dini_IntSet(filename, "buybar", 1);				return 1;			}   	        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);   	    	format(filename, sizeof(filename), "%d", GetPlayerVehicleID(playerid));			dini_Set(filename, "owner", "server");			dini_IntSet(filename, "bought", 0);			dini_IntSet(filename, "secure", 0);			dini_IntSet(filename, "buybar", 1);			if(dini_Exists(udb_encode(var1))) {			    tempid[playerid] = IsPlayerNameOnline(var1);			    if(tempid[playerid] >= 0 || tempid[playerid] < 999) {			        bank[tempid[playerid]] = bank[tempid[playerid]]+carcost[playerid];					dini_IntSet(udb_encode(var1), "car", 0);					dini_IntSet(udb_encode(var1), "carowned", 0);					format(string, sizeof(string), "You just sold %s's vehicle and set it to non-buyable. The sale money ($%d) was sent to %s's online bank account", var1, carcost[playerid], var1);					SendClientMessage(playerid, COLOR_ORANGE, string);					format(string, sizeof(string), "Admin (%s) has just sold %s's vehicle and set it to non-buyable! The sale money was sent to %s's online bank account!", playername, var1, var1);					SendClientMessageToAll(COLOR_ORANGE, string);					format(string, sizeof(string), "Admin (%s) has just sold your vehicle and set it to non-buyable! The sale money ($%d) was sent to your online bank account!", playername, carcost[playerid]);                    SendClientMessage(tempid[playerid], COLOR_ORANGE, string);					return 1;				}				if(tempid[playerid] == 999) {				    bank[tempid[playerid]] = dini_Int(udb_encode(ownername), "bank");				    bank[tempid[playerid]] = bank[tempid[playerid]]+carcost[playerid];				    dini_IntSet(udb_encode(var1), "car", 0);					dini_IntSet(udb_encode(var1), "carowned", 0);					dini_IntSet(udb_encode(var1), "carsold", 1);					dini_IntSet(udb_encode(var1), "bank", bank[tempid[playerid]]);					format(string, sizeof(string), "You just sold %s's vehicle and set it to non-buyable. The sale money ($%d) was sent to %s's online bank account", var1, carcost[playerid], var1);					SendClientMessage(playerid, COLOR_ORANGE, string);					format(string, sizeof(string), "Admin (%s) has just sold %s's vehicle and set it to non-buyable! The sale money was sent to %s's online bank account!", playername, var1, var1);					SendClientMessageToAll(COLOR_ORANGE, string);					return 1;				}			}			if(!dini_Exists(udb_encode(var1))) {				format(string, sizeof(string), "You just sold %s's vehicle and set it to non-buyable. The player file was not found and cannot be altered.", var1);				SendClientMessage(playerid, COLOR_GREEN, string);				format(string, sizeof(string), "Admin (%s) has just sold %s's vehicle and set it to non-buyable! The sale money was sent to The San Andreas Hospital Trust!", playername, var1);				SendClientMessageToAll(COLOR_ORANGE, string);				return 1;			}		}		SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not a server administrator and cannot use this command!");		return 1;	}