16.10.2010, 01:27
Sorry, forgot to paste the code..
Everything there including gLastcar from /detain command..
/sellweapon command would derive from this somehow
I know for a fact you have to remove
But the only thing that confuses me is twisting the code around so it actually gives another person a license and not you.
Код:
new gLastCar[MAX_PLAYERS];
Код:
if(strcmp(cmd, "/detain", true) ==0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1) { if(CopOnDuty[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, "(ERROR) You are not on duty"); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, "(ERROR) You can not use this whilst in a car"); return 1; } tmp = strtok(cmdtext, idx); if (!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /detain [playerid/partofname] [seatid]"); return 1; } new carid = gLastCar[playerid]; giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "(ERROR) You can not detain yourself"); return 1; } tmp = strtok(cmdtext, idx); new seat = strval(tmp); if(seat < 1 || seat > 3) { SendClientMessage(playerid, COLOR_GREY, "(ERROR) The seat ID can not be above 3 or below 1"); return 1; } if (!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "(USAGE) /detain [playerid/partofname] [seatid]"); return 1; } if(!ProxDetectorS(8.0, playerid, giveplayerid)) { SendClientMessage(playerid, COLOR_GREY, "(ERROR) That player is not in range"); return 1; } if(PlayerCuffed[giveplayerid] > 0) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "(INFO) You were detained by %s", sendername); SendClientMessage(giveplayerid, COLOR_WHITE, string); format(string, sizeof(string), "(INFO) You detained %s", giveplayer); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "%s grabs %s and throws him in the car", sendername ,giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GameTextForPlayer(giveplayerid, "~r~BUSTED", 2500, 3); ClearAnimations(giveplayerid); TogglePlayerControllable(giveplayerid, 0); PutPlayerInVehicle(giveplayerid,carid,seat); PlayerCuffed[giveplayerid] = 1; } else { SendClientMessage(playerid, COLOR_GREY, "(ERROR) That player is not cuffed"); return 1; } } } } else { SendClientMessage(playerid, COLOR_GREY, "(ERROR) Invalid faction"); } }//not connected return 1; }
Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { gLastCar[playerid] = GetPlayerVehicleID(playerid); if(DynamicCars[GetPlayerVehicleID(playerid)-1][CarType] != 1) {
/sellweapon command would derive from this somehow
pawn Код:
if(strcmp(cmd, "/buyweaponlicense", true) == 0)
{
if(PlayerToPoint(1.0,playerid,WeaponLicensePosition[X],WeaponLicensePosition[Y],WeaponLicensePosition[Z]))
{
if(GetPlayerVirtualWorld(playerid) == WeaponLicensePosition[World])
{
if(PlayerInfo[playerid][pWepLic] == 0)
{
if(GetPlayerCash(playerid) >= 50000)
{
GivePlayerCash(playerid,-50000);
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[INFO:] You can now use weapons legally, within reason of course.");
PlayerInfo[playerid][pWepLic] = 1;
OnPlayerDataSave(playerid);
}
else
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] You don't have enough money!");
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] You already have a license!");
}
}
}
else
{
SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] You are not at the license location!");
}
return 1;
}
Код:
if(GetPlayerCash(playerid) >= 50000) { GivePlayerCash(playerid,-50000);