09.03.2013, 19:04
First, you will need the following under your #includes
And copy the following OnPlayerCommandText CallBack.
public OnPlayerCommandText(playerid, cmdtext[])
Should work, not tested.
NOTE: This may be buggy as it will always TP the player inside the front seat. ( Near the driver )
And if that seat is taken then..
pawn Код:
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;
}
public OnPlayerCommandText(playerid, cmdtext[])
pawn Код:
{
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;
}
NOTE: This may be buggy as it will always TP the player inside the front seat. ( Near the driver )
And if that seat is taken then..