if(strcmp(cmd, "/drag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PINFO[playerid][pAdmin] <= 0)
{
SCM(playerid,COLOR_ERROR,"Error: Error: Your admin level isn't high enough to use this command");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "Syntax: /drag <PlayerID/PartOfName>");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
new playa;
playa = ReturnUser(tmp);
if(!newcar) { SCM(playerid,COLOR_ERROR,"You are not in a vehicle."); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
PutPlayerInVehicle(playa,newcar,1);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new sttr[256];
format(sttr,256,"Admin %s drags you to his/her vehicle.",sendername);
SCM(playa,COLOR_AdminWarn,sttr);
SCM(playerid,COLOR_ERROR,"Dragged.");
}
}
}
return 1;
}
#include <sscanf>
CMD:drag(playerid, params[])
{
new name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], id;
GetPlayerName(id, name,sizeof(name));
if(IsPlayerConnected(playerid))
{
if(PINFO[playerid][pAdmin] <= 0)
{
SCM(playerid,COLOR_ERROR,"Error: Your admin level isn't high enough to use this command");
return 1;
}
if(sscanf(params,"i",id))
{
SendClientMessage(playerid, COLOR_YELLOW, "Syntax: /drag <PlayerID>");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
if(!newcar) { SCM(playerid,COLOR_ERROR,"You are not in a vehicle."); return 1; }
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
PutPlayerInVehicle(id,newcar,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
new sttr[256];
format(sttr,256,"Admin %s drags you to his/her vehicle.",sendername);
SCM(playa,COLOR_AdminWarn,sttr);
SCM(playerid,COLOR_ERROR,"Dragged.");
}
}
}
return 1;
}
CMD:drag(playerid, params[])
{
new name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], id, sttr[100];
if(!IsPlayerConnected(id)) return SCM(playerid, 0xFF0000FF, "Error: Inactive userid!");
if(PINFO[playerid][pAdmin] <= 0) return SCM(playerid,COLOR_ERROR,"Error: Your admin level isn't high enough to use this command");
if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_YELLOW, "Syntax: /drag <PlayerID>");
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_ERROR,"You are not in a vehicle.");
new newcar = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(id,newcar,1);
GetPlayerName(id, name,sizeof(name));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(sttr,sizeof(sttr),"Admin %s drags you to his/her vehicle.",sendername);
SCM(id, COLOR_AdminWarn, sttr);
SCM(playerid,COLOR_ERROR,"Dragged.");
return 1;
}
why you made so long command it can be done simple as that
PHP код:
|