08.03.2013, 23:52
(
Последний раз редактировалось Vytixz; 14.03.2016 в 23:08.
)
dsadsadsadsa
0 - Driver 1 - Front Passenger 2 - Back left passenger 3 - Back right passenger 4+ - Passenger seats (coach etc.) |
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/cp", cmdtext, true, 10) == 0)
{
new targetplayer[MAX_PLAYER_NAME];
targetplayer = strtok(cmdtext, idx);
if(strlen(targetplayer) == 0) return SendClientMessage(playerid, -1, "USAGE: /cp [playerid]");
if(!IsPlayerInAnyVehicle(strval(targetplayer))) return SendClientMessage(playerid, -1, "ERROR: Chosen player is not in any vehicle!");
PutPlayerInVehicle(playerid, GetPlayerVehicleID(strval(targetplayer)), 1);
SendClientMessage(playerid, -1, "(Info): You have successfuly teleported into a player's vehicle.");
return 1;
}
return 0;
}
LEANCMD:(seats)
{
SCM(playerid, COLOR_AO, "Carseats ID");
SCM(playerid, COLOR_AO, "0 - Driver");
SCM(playerid, COLOR_AO, "1 - Front Passenger");
SCM(playerid, COLOR_AO, "2 - Back left passenger");
SCM(playerid, COLOR_AO, "3 - Back right passenger");
return 1;
}
LEANCMD:(getin)
{
new currentveh, id, seat;
currentveh = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_GREY, "You have to be inside a vehicle to teleport a player inside your car");
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
if(sscanf(params, "ui", id, seat)) return SCM(playerid, COLOR_GREY, "/getin [partofname/playerid] [seat] [/seats to check seatIDs]");
if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_GREY, "This player is not connected");
if(IsPlayerInVehicle(id, currentveh))
{
RemovePlayerFromVehicle(id);
PutPlayerInVehicle(id, currentveh, seat);
}
else
{
PutPlayerInVehicle(id, currentveh, seat);
}
return 1;
}
LEANCMD:(goin)
{
new currentveh, id, seat;
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
if(sscanf(params, "ui",id, seat)) return SCM(playerid, COLOR_GREY, "/goin [partofname/playerid] [seat] [/seats to check seatIDs]");
if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_GREY, "This player is not connected");
else
{
currentveh = GetPlayerVehicleID(id);
PutPlayerInVehicle(playerid, currentveh, seat);
}
return 1;
}