New to scripting
#1

Hello, I'm kinda new to scripting, I've been doing it for a couple of months now but I only know the basic stuff. lately I've been looking up tutorials on lots of things on the pawno language because I want to learn more. I am finding it hard at times but most of it I understand. If there's anyone out there that's great with scripting, I'd appreciate it if you could teach me a little. I've hired a lot of scripters for my server but some of them weren't trustworthy and I can't seem to trust anyone anymore.. So I've decided to learn it so I can script myself. If anyones willing to help teach me, send me a message or add me on skype! joshmain1996

Also, I'm trying to script just a simple /kick command at the moment and I'm getting an error that I don't understand.

"Symbol isn't defined "giveplayer" ."

Код:
if(strcmp("/kick", cmdtext, true, 10) == 0)
	
 	{
	   	 	if(IsPlayerConnected(giveplayerid))
	        	{
				new string[128];
				format(string, sizeof(string), "%s was kicked by %s, reason: %s", GetPlayerName(giveplayerid), GetPlayerName(playerid), reason);
				SendClientMessageToAll(0xFFFF00AA, string);
				Kick(giveplayerid);
				return 1;
				}
		}
Sorry to sound noob, but I need a little help if anyones up for it! Thanks in advanced
Reply
#2

try this
pawn Код:
if(strcmp("/kick", cmdtext, true, 5) == 0)
    {
    if(IsPlayerAdmin(playerid)){ // Check if you're an admin.
      if(!strlen(cmdtext[6])){
        return SendClientMessage(playerid, 0xFFAA00AA, "Usage: /kick [targetid]");
      }
        new targetid = strval(cmdtext[6]);
        if(IsPlayerConnected(targetid)){
          new string[128], playername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME];
          GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
          GetPlayerName(targetid, targetname, MAX_PLAYER_NAME);
          format(string, 128, "Admin %s kicked you from the server.", playername);
                SendClientMessage(targetid, 0xFFAA00AA, string);
            Kick(targetid);
          format(string, 128, "Admin %s kicked %s from the server.", playername, targetname);
                SendClientMessageToAll(0xFFAA00AA, string);
        }
        else{
        return SendClientMessage(playerid, 0xFFAA00AA, "That player is not connected.");
        }
    }
    else{
      return SendClientMessage(playerid, 0xFFAA00AA, "RCON Admin only.");
    }
      return 1;
    }
Reply
#3

You might just want to start by getting your terminology correct. Pawn is the language, Pawno is a editor. You should also start using newer methods (ZCMD, sscanf) instead of relying on old stuff like strcmp commands and strtok.
Reply
#4

Thanks both of you haha
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)