CMD:v(playerid, params[])
{
new
toid,
toname[MAX_PLAYER_NAME],
carid[20],
color1,
color2,
vid;
if(pInfo[playerid][Admin] > 1){
new randcolor1 = randomEx(1, 253);
new randcolor2 = randomEx(1, 253);
new test[128];
format(test, sizeof(test), "s[45]s[20]I(%i)I(%i)", randcolor1, randcolor2);
if(!sscanf(params, test, toname, carid, color1, color2)) {
toid = GetPlayerIdFromName(toname);
if(!strcmp(toname, "me", true, 3)){
toid = playerid;
}
if(IsPlayerConnected(toid)){
vid = FindVehicleByNameID(carid);
if(399 < vid < 612){
new
NewV,
Float: curX,
Float: curY,
Float: curZ,
Float: curR,
Float: curVX,
Float: curVY,
Float: curVZ,
MessageToSender[128],
MessageToReciever[128],
allmessage[128],
SenderName[25],
RecieverName[25];
GetPlayerName(playerid, SenderName, 18);
GetPlayerName(toid, RecieverName, 18);
GetPlayerPos(toid, curX, curY, curZ);
GetPlayerFacingAngle(playerid, curR);
WasInVehicle[toid] = 0;
//get any passengers
new
pass1 = 0,
pass2 = 0,
pass3 = 0,
pass1id,
pass2id,
pass3id;
if(IsPlayerInAnyVehicle(toid)){
if(GetPlayerState(toid) == 2){
new ocarid;
ocarid = GetPlayerVehicleID(toid);
GetVehicleVelocity(ocarid, curVX, curVY, curVZ);
GetVehicleZAngle(ocarid, curR);
RemovePlayerFromVehicle(ocarid);
DestroyVehicle(ocarid);
WasInVehicle[toid] = 1;
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerInAnyVehicle(i)){
if(IsPlayerInVehicle(i, ocarid)){
if(GetPlayerVehicleSeat(i) == 1){
pass1 = 1;
pass1id = i;
}
if(GetPlayerVehicleSeat(i) == 2){
pass2 = 1;
pass2id = i;
}
if(GetPlayerVehicleSeat(i) == 3){
pass3 = 1;
pass3id = i;
}
}
}
}
}
}
NewV = CreateVehicle(vid, curX+1, curY+1, curZ, curR, color1, color2, -1);
SetVehicleNumberPlate(NewV, RecieverName);
SetVehicleToRespawn(NewV);
PutPlayerInVehicle(toid, NewV, 0);
if(WasInVehicle[toid] == 1){
SetVehicleVelocity(NewV, curVX, curVY, curVZ);
WasInVehicle[toid] = 0;
if(pass1 == 1){
PutPlayerInVehicle(pass1id, NewV, 1);
}
if(pass2 == 2){
PutPlayerInVehicle(pass2id, NewV, 2);
}
if(pass3 == 3){
PutPlayerInVehicle(pass3id, NewV, 3);
}
}
format(MessageToSender, sizeof(MessageToSender), "Car '%s' sent to %s.", GetVehicleName(vid), RecieverName);
format(MessageToReciever, sizeof(MessageToReciever), "%s has just spawned you a car (%s).", SenderName, GetVehicleName(vid));
format(allmessage, sizeof(allmessage), "%s has sent a(n) %s to %s!", SenderName, GetVehicleName(vid), RecieverName);
SendClientMessage(playerid, COLOR_LIGHTPINK, MessageToSender);
SendClientMessage(toid, COLOR_LIGHTPINK, MessageToReciever);
SendClientMessageToAllButTwo(playerid, toid, COLOR_LIGHTPINK, allmessage);
return true;
} else {
new errorstring[128];
format(errorstring, sizeof(errorstring), "ERROR: %s is not a valid car name!");
SendClientMessage(playerid, COLOR_LIGHTPINK, errorstring);
SendClientMessage(playerid, COLOR_LIGHTPINK, "Don't use spaces, use '_' instead. EX: Hotring_Racer_A");
}
} else {
new errorstring[128];
format(errorstring, sizeof(errorstring), "ERROR: %i is not a valid player!", toid);
SendClientMessage(playerid, COLOR_LIGHTPINK, errorstring);
}
} else {
SendClientMessage(playerid, -1, "USAGE: /v [Playername / me] [car name / part of name] [color1] [color2]");
}
} else {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You don't have access to this command.");
}
return 1;
}
CreateVehicle(vid, curX+1, curY+1, curZ, curR, color1, color2, -1);
CreateVehicle(vid, curX+1, curY+1, curZ, curR, color1, color2, 60000*5);
/*
Parameters:
--------------------------------------------------------------------------
(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay)
modelid The model for the vehicle.
Float:X The X coordinate for the vehicle.
Float:Y The Y coordinate for the vehicle.
Float:Z The Z coordinate for the vehicle.
Float:angle The facing angle for the vehicle.
color1 The primary color ID.
color2 The secondary color ID.
respawn_delay The delay until the car is respawned without a driver in seconds.
#from Wiki_Samp*/
respawn_delay The delay until the car is respawned without a driver in seconds. = CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60); 60 = 60seconds (one minutes)
OnVehicleSpawn(vehicleid)
{
destroyvehicle(vehicleid);
}
pawn Код:
Код:
respawn_delay The delay until the car is respawned without a driver in seconds. = CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60); 60 = 60seconds (one minutes) |
Well, if I had it like tihs
pawn Код:
|