How to make a .. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make a .. (
/showthread.php?tid=177486)
How to make a .. -
Matej_ - 18.09.2010
I need a help making a slap and give weapon command.
Example:
* Matej_ slaps [playerid] [reason] around a bit with a large trout.
/giveweapon [playerid] [ammount]
Re: How to make a .. -
nejc001 - 18.09.2010
Copied from ladmin
Код:
if(strcmp(cmd, "/slap", true) == 0) {
if(PlayerInfo[playerid][Level] >= 2) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, red, "USAGE: /slap [playerid] [reason]");
return 1; }
new player1;
player1 = strval(tmp);
if(!IsPlayerConnected(player1) || player1 == INVALID_PLAYER_ID || (PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel]) ) {
SendClientMessage(playerid,red,"ERROR: Player is not connected or is yourself");
return 1; }
tmp = strtok(cmdtext, idx);
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
format(string,256,"You have been slapped by Administrator %s %s ",adminname,cmdtext[7]); SendClientMessage(player1,red,string);
format(string,256,"You have slapped %s %s ",playername,cmdtext[7]); SendClientMessage(playerid,blue,string);
new Float:Health, Float:x, Float:y, Float:z; GetPlayerHealth(player1,Health); SetPlayerHealth(player1,Health-25); GetPlayerPos(player1,x,y,z); SetPlayerPos(player1,x,y,z+5); PlayerPlaySound(playerid,1190,0.0,0.0,0.0); PlayerPlaySound(player1,1190,0.0,0.0,0.0);
} else {
SendClientMessage(playerid,red,"ERROR: You need to be level 2 to use this command"); }
return 1; }
You mean /giveweapon [playerid] [weaponid] [ammo ammount] for admins?
Or that player who holds the weapon want to give other player his weapon for the ammount of ammo he wants.
Re: How to make a .. -
Kyosaur - 18.09.2010
Look into sscanf and zcmd
. The both make handling commands with parameters pretty simple.
Re: How to make a .. -
Matej_ - 18.09.2010
I don't want this commands to be for admins.
Can you guys make it for non-admins ?
Re: How to make a .. -
Seven. - 18.09.2010
With dcmd + scanff
Copyed this from my admin script.
pawn Код:
dcmd_slap(playerid, params[])
{
new slapid;
new string[128];
new reason[128];
if(sscanf(params, "uz", slapid, reason)) return SendClientMessage(playerid,red,"Error: /slap <playerid/name> Reason.");
if(!IsPlayerConnected(slapid) || slapid == INVALID_PLAYER_ID || slapid == playerid) return SendClientMessage(playerid,red,"Error: Player is not connected or it is yourself.");
format(string,sizeof(string),"Admin: %s(id: %d) has slapped %s(id: %d) Reason: %s.",UserUD[playerid][accname],playerid,UserUD[slapid][accname],slapid,reason);
SendClientMessageToAll(adminaction,string);
new Float:x,
Float:y,
Float:z;
GetPlayerPos(slapid, x,y,z);
SetPlayerPos(slapid, x, y, z+8);
PlayerPlaySound(slapid, 1190, 0,0,0);
}
return 1;
}
Re: How to make a .. -
Dime - 18.09.2010
You didnt can use search!?
Re: How to make a .. -
Matej_ - 18.09.2010
Quote:
Originally Posted by Seven.
With dcmd + scanff
Copyed this from my admin script.
pawn Код:
dcmd_slap(playerid, params[]) { new slapid; new string[128]; new reason[128];
if(sscanf(params, "uz", slapid, reason)) return SendClientMessage(playerid,red,"Error: /slap <playerid/name> Reason."); if(!IsPlayerConnected(slapid) || slapid == INVALID_PLAYER_ID || slapid == playerid) return SendClientMessage(playerid,red,"Error: Player is not connected or it is yourself."); format(string,sizeof(string),"Admin: %s(id: %d) has slapped %s(id: %d) Reason: %s.",UserUD[playerid][accname],playerid,UserUD[slapid][accname],slapid,reason); SendClientMessageToAll(adminaction,string);
new Float:x, Float:y, Float:z; GetPlayerPos(slapid, x,y,z); SetPlayerPos(slapid, x, y, z+8); PlayerPlaySound(slapid, 1190, 0,0,0); } return 1; }
|
Thanks !
I'm going to try if it works.
Re: How to make a .. -
Matej_ - 18.09.2010
It doesn't work I just get 6 errors.
Re: How to make a .. -
Dime - 18.09.2010
What errors??
Re: How to make a .. -
Matej_ - 18.09.2010
Quote:
Originally Posted by oттo
What errors??
|
I get 2 errors.
pawn Код:
... (165) : error 010: invalid function or declaration
(301) : warning 203: symbol is never used: "dcmd_slap"