CMD:derby(playerid, params[]) { new str7[128], player8[MAX_PLAYER_NAME]; GetPlayerName(playerid, player8, sizeof(player8)); format(str7,sizeof(str7),"%s teleportis end derbysse [/derby]",player8); SendClientMessageToAll(COLOR_GREEN,str7); new rand = random(sizeof(D1Rand)); SetPlayerPos(playerid, D1Rand[rand][0], D1Rand[rand][1], D1Rand[rand][2]); SendClientMessage(playerid, COLOR_NGREEN,"Teleportisid end derbysse!"); ResetPlayerWeapons(playerid); nocmd[playerid] = 1; return 1; }
I want a command that when I type /car, an Infernus will be spawned and I will be put inside it right away.
Optional: A message in the chat saying "You have successfully spawned an infernus." Thank you. |
//Somewhere on top of your script, under #includes
new CarSpawned[MAX_PLAYERS];
CMD:car(playerid, params[])
{
#pragma unused params
if(CarSpawned[playerid] > 0)
DestroyVehicle(CarSpawned[playerid]);
new Float: Pos[4];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
CarSpawned[playerid] = CreateVehicle(411, Pos[0], Pos[1], Pos[2], Pos[3], 1, 1, 0);
PutPlayerInVehicle(playerid, CarSpawned[playerid], 0);
SendClientMessage(playerid, -1, "You have successfully spawned an Infernus.");
return 1;
}
//Somewhere on top of your script, under #includes
new MaxPing = 500;
CMD:setping(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "You're not allowed to use this command.");
new ping, str[65], name[MAX_PLAYER_NAME];
if(sscanf(params, "i", ping))
return SendClientMessage(playerid, -1, "USAGE: /setping [MAX PING]");
if(ping < 20 || ping > 1000)
return SendClientMessage(playerid, -1, "Use real values, between 20 and 1000");
GetPlayerName(playerid, name, sizeof name);
MaxPing = ping;
format(str, sizeof str, "Admin %s set the max ping to %i.", name, MaxPing);
SendClientMessageToAll(-1, str);
return 1;
}
//And now, under OnPlayerUpdate callback;
public OnPlayerUpdate(playerid)
{
if(GetPlayerPing(playerid) > MaxPing) Kick(playerid);
return 1;
}
//On top of your script, under #includes
new playerWarn[MAX_PLAYERS];
CMD:warn(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
new pID, str[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
if(sscanf(params, "u", pID))
return SendClientMessage(playerid, -1, "Usage: /warn [Player ID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
playerWarn[pID] ++;
GetPlayerName(playerid, pName, sizeof pName);
GetPlayername(pID, name, sizeof name);
format(str, sizeof str, "Admin %s warned you. Total warnings %i.", pName, playerWarn[pID]);
SendClientMessage(pID, -1, str);
format(str, sizoef str, "You warned player %s. Total warnings %i.", name, playerWarn[pID]);
SendClientMessage(playerid, -1, str);
if(playerWarn[pID] > 2)
{
format(str, sizeof str, "%s accumulated 3 warnings and got kicked from the server.", name);
SendClientMessageToAll(-1, str);
SendClientMessage(pID, -1, "You were warned three (3) times and got kicked.");
Kick(pID);
}
return 1;
}
CMD:kick(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
new pID, str[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
if(sscanf(params, "u", pID))
return SendClientMessage(playerid, -1, "Usage: /kick [Player ID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
GetPlayerName(playerid, pName, sizeof pName);
GetPlayerName(pID, name, sizeof name);
format(str, sizeof str, "You kicked player %s.", name);
SendClientMessage(playerid, -1, str);
format(str, sizeof str, "Admin %s kicked you.", pName);
SendClientMessage(pID, -1, str);
format(str, sizeof str, "Admin %s kicked player %s.", pName, name);
SendClientMessageToAll(-1, str);
Kick(pID);
return 1;
}
I need a detain command that places said id into the last car you was in (Must be close to the car and person though) the command I would like is to be /detain [thereid] [seatid] I would prefer the command script to be in ZCMD. This won't be used as a police faction only command therefore I want it so everyone can use it.
Thank you. |
//On top of your script
new LastCar[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
LastCar[playerid] == GetPlayerVehicleID(playerid);
return 1;
}
CMD:detain(playerid, params[])
{
if(LastCar[playerid] < 1)
return SendClientMessage(playerid, -1, "You haven't entered a vehicle, as a driver yet.");
new Float: vehPos[3], Float: Pos[3], pID, str[128], seatid, pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
if(sscanf(params, "ui", pID, seatid))
return SendClientMessage(playerid, -1, "Usage: /detain [Player ID] [Seat (1-3)]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
if(seatid < 1 || seatid > 3)
return SendClientMessage(playerid, -1, "Invalid seat ID. Use values between 1 and 3");
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if(!IsPlayerInRangeOfPoint(pID, 5.0, Pos[0], Pos[1], Pos[2]))
return SendClientMessage(playerid, -1, "Selected player is not close enough.");
GetVehiclePos(LastCar[playerid], vehPos[0], vehPos[1], vehPos[2]);
if(!IsPlayerInRangeOfPoint(playerid, 10.0, vehPos[0], vehPos[1], vehPos[2]))
return SendClientMessage(playerid, -1, "You're not near the last vehicle.");
GetPlayerName(playerid, pName, sizeof pName);
GetPlayerName(pID, name, sizeof name);
format(str, sizeof str, "You detained %s in the vehicle ID %i, seat %i.", name, LastCar[playerid], seatid);
SendClientMessage(playerid, -1, str);
format(str, sizeof str, "You've been detained by %s in vehicle ID %i, seat %i.", pName, LastCar[playerid], seatid);
SendClientMessage(pID, -1, str);
PutPlayerInVehicle(pID, LastCar[playerid], seatid);
return 1;
}
First !! I need a derby system, that when a player enters the derby, the limit is 4 (i have 4 cars) and if 4 are in the derby no-one else can join, the last on in the derby gets 10k and the cars will respawn. And it starts again.
Heres my zcmd : Code:
CMD:derby(playerid, params[]) { new str7[128], player8[MAX_PLAYER_NAME]; GetPlayerName(playerid, player8, sizeof(player8)); format(str7,sizeof(str7),"%s teleportis end derbysse [/derby]",player8); SendClientMessageToAll(COLOR_GREEN,str7); new rand = random(sizeof(D1Rand)); SetPlayerPos(playerid, D1Rand[rand][0], D1Rand[rand][1], D1Rand[rand][2]); SendClientMessage(playerid, COLOR_NGREEN,"Teleportisid end derbysse!"); ResetPlayerWeapons(playerid); nocmd[playerid] = 1; return 1; } |
pawn Code:
pawn Code:
|
C:\Users\winny\Desktop\MGRP\SAMP\Samp server\gamemodes\MG.pwn(529) : warning 215: expression has no effect Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
LastCar[playerid] == GetPlayerVehicleID(playerid);
CreatePlayerProgressBar(playerid, 3.00, 442.00, 634.50, 3.20, 12989183, 100.0);
//Near the top of your script
new
vNames[212][] =
{
"Landstalker", "Bravura", "Buffalo", "Linerunner", "Pereniel", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
"Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat", "Mr Whoopee", "BF Injection",
"Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
"Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
"Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider",
"Glendale", "Oceanic", "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR3 50", "Walton", "Regina",
"Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood",
"Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B",
"Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", "RoadTrain",
"Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck",
"Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover",
"Sadler", "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster A",
"Monster B", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight", "Trailer",
"Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer A", "Emperor",
"Wayfarer", "Euros", "Hotdog", "Club", "Trailer B", "Trailer C", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
"Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T. Van", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A", "Luggage Trailer B",
"Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer"
}
;
//Near the bottom in your script
ReturnVehicleID(vName[])
{
for(new x; x != 211; x++) if(strfind(vNames[x], vName, true) != -1) return x + 400;
return INVALID_VEHICLE_ID;
}
//Command using ZCMD and sscanf.
COMMAND:car(playerid, params[])
{
new carName[100];
if(sscanf(params, "s[100]", carName)) return SendClientMessage(playerid, 0xa9c4e4ff, "Usage: /car [name]");
else if(ReturnVehicleID(carName) == INVALID_VEHICLE_ID) return SendClientMessage(playerid, 0xa9c4e4ff, "Unknown car name!");
else
{
new Float:pPos[4], vid;
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
vid = CreateVehicle(ReturnVehicleID(carName), pPos[0], pPos[1], pPos[2] + 1.00, pPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, vid, 0);
}
return 1;
}
new bool:ServerLocked;
public OnGameModeInit()
{
ServerLocked = false;
return 1;
}
public OnPlayerConnect(playerid)
{
if(ServerLocked) { Kick(playerid); }
return 1;
}
COMMAND:lockserver(playerid, params[])
{
if(ServerLocked)
{
ServerLocked = false;
SendClientMessage(playerid, 0xa9c4e4ff, "Server is no longer locked!");
}
else
{
ServerLocked = true;
SendClientMessage(playerid, 0xa9c4e4ff, "Server is now locked!");
}
return 1;
}