Here you go
This will only slap their vehicle
PHP код:
CMD:slapcar(playerid,params[]) {
new otherplayer, othercar;
if(sscanf(params,"u",otherplayer)) return SendClientMessage(playerid,COLOR_RED,"Usage: /slapcar [playerid]");
if(!IsPlayerInAnyVehicle(otherplayer)) return SendClientMessage(playerid,COLOR_RED,"That player is not inside any vehicles");
new Float:x,Float:y,Float:z;
othercar = GetPlayerVehicleID(otherplayer);
GetVehiclePos(othercar,x,y,z);
SetVehiclePos(othercar,x,y,z+10); //slap their vehicle
new string[128];
format(string,sizeof(string),"You slapped vehicle ID: %i",othercar);
SendClientMessage(playerid,COLOR_RED,string);
return true;
}
This will slap the player & their vehicle
PHP код:
CMD:slapcar(playerid,params[]) {
new otherplayer, othercar;
if(sscanf(params,"u",otherplayer)) return SendClientMessage(playerid,COLOR_RED,"Usage: /slapcar [playerid]");
if(!IsPlayerInAnyVehicle(otherplayer)) return SendClientMessage(playerid,COLOR_RED,"That player is not inside any vehicles");
new Float:x,Float:y,Float:z;
othercar = GetPlayerVehicleID(otherplayer);
GetVehiclePos(othercar,x,y,z);
SetVehiclePos(othercar,x,y,z+10); //slap their vehicle
new string[128];
format(string,sizeof(string),"You slapped vehicle ID: %i",othercar);
SendClientMessage(playerid,COLOR_RED,string);
GetPlayerPos(otherplayer,x,y,z);
SetPlayerPos(otherplayer,x,y,z+10);
return true;
}