dcmd_kick(playerid, params[])
{
#pragma unused params
if(admin[playerid] >= 1)
{
new id[256];
new cmdtext[256];
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
id = strtok(params, idx);
if(!strlen(id))
{
SendClientMessage(playerid, COLOR_GOLD, "USAGE: /kick [ID]");
return 1;
}
new pID = strval(id);
SendClientMessage(pID, COLOR_GOLD, "You have been kicked");
Kick(pID);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GOLD, "You are not an admin!");
}
return 1;
}
public OnPlayerConnect(playerid)
{
new first[MAX_PLAYER_NAME], last[MAX_PLAYER_NAME];
if(RPName(PlayerName(playerid),first,last))
{
return 0;
}
else
{
KickPlayer(playerid,"the server","Invalid Name, Correct Format: Firstname_Lastname");
}
return 1;
}
RPName(name[],ret_first[],ret_last[])//this will explaine the RPname just put it somewhere but nut in a public{}//
{
new len = strlen(name),
point = -1,
bool:done = false;
for(new i = 0; i < len; i++)
{
if(name[i] == '_')
{
if(point != -1) return 0;
else {
if(i == 0) return 0;
point = i + 1;
}
} else if(point == -1) ret_first[i] = name[i];
else {
ret_last[i - point] = name[i];
done = true;
}
if(strcmp(cmd, "/kick", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /kick [playerid/partofname] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /kick [playerid/partofname] [reason]");
return 1;
}
KickPlayer(giveplayerid,GetPlayerNameEx(playerid),(result));
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid Playerid/Name");
}
}
return 1;
}
|
Originally Posted by ekeleke
Here you go the /kick playerid reason
Код:
if(strcmp(cmd, "/kick", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /kick [playerid/partofname] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /kick [playerid/partofname] [reason]");
return 1;
}
KickPlayer(giveplayerid,GetPlayerNameEx(playerid),(result));
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid Playerid/Name");
}
}
return 1;
}
|
|
Originally Posted by Wazza!
The Scripting Discussion section is for this.
|
#include<a_samp>
public OnPlayerRequestClass(playerid,classid)// of zoiets wat erop lijkt
{
ApplyAnimation(playerid,"DANCING","dance_loop",4.1,1,1,1,1,1);
return 1;
}
public OnPlayerSpawn(playerid)
{
ClearAnimations(playerid);
return 1;
}

if(strcmp(cmdtext, "/buybomb", true) == 0)
{
if (PlayerToPoint(1, playerid,-50.4694,-233.4252,6.7646))
{
if(Bomb[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "[Error] You can only carry 1 bomb");
return 1;
}
if(GetPlayerCash(playerid) >= 30000)
{
Bomb[playerid] = 1;
GivePlayerCash(playerid,-30000);
SendClientMessage(playerid, COLOR_WHITE, "[Success] You bought a bomb, it does not save so use it quickly");
PlayerActionMessage(playerid,15.0,"gives the business some money and gets a bomb back in return");
return 1;
}
else
{
endClientMessage(playerid, COLOR_GREY, "[Error] You do not have enough money");
return 1;
}
}