SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/10/2012, 08:00 PM   #1
EthanCortez
Little Clucker
 
Join Date: Sep 2012
Posts: 32
Reputation: 0
Default PAWNO help

HTML Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/kick", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{33CCFF}USAGE:{FFFFFF} /kick [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
     					GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "{33CCFF}USAGE:{FFFFFF} /kick [playerid/PartOfName] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),day,month,year);
						KickLog(string);
						PlayerJailLog(string,giveplayer);
						format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						Kick(giveplayerid);
						return 1;
					}
				}
				else
				{
					format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
					SendClientMessage(playerid, COLOR_GRAD1, string);
				}
			}
			else return SendClientMessage(playerid, COLOR_GRAD1, "   {BCD4E6}Error: {FFFFFF}Sorry, you cant use this command.");
		}
		return 1;
	}


if(strcmp(cmd, "/ajail", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /ajail [Playerid] [time(minutes)] [Reason]");
				return 1;
			}
			new playa;
			new money;
			playa = strval(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				format(result, sizeof(result), "Unknown");
			}
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			            if(money>0)
			            {
				        	GetPlayerName(playa, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							ResetPlayerWeapons(playa);
							PlayerInfo[playa][pJailed] = 2;
							PlayerInfo[playa][pJailTime] = money * 60;
							SetPlayerInterior(playa, 0);
							SetPlayerVirtualWorld(playa, playa+1);
							PlayerInfo[playa][pVirWorld] = playa+1;
							PlayerInfo[playa][pInt] = 0;
							SetPlayerPos(playa, 2524.3831,-1673.9191,14.8585);
							format(string, sizeof(string), "%s was jailed by the admin %s for: %d minutes. Reason : %s",giveplayer,sendername,money,result);
							SendClientMessageToAll(COLOR_RED, string);
							format(string, sizeof(string), "The admin %s jailed you for %d minutes.", sendername,money);
							SendClientMessage(playa, COLOR_WHITE, string);
							PlayerJailLog(string,giveplayer);
						}
						else if(money==0)
						{
						    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "* You were released by the Admin %s.", sendername);
							SendClientMessage(playa, COLOR_WHITE, string);
							//ResetPlayerWeapons(playa);
							PlayerInfo[playa][pJailed] = 2;
							PlayerInfo[playa][pJailTime] = money * 60;
							SetPlayerInterior(playa, 0);
							SetPlayerVirtualWorld(playa, playa+1);
							PlayerInfo[playa][pVirWorld] = playa+1;
							PlayerInfo[playa][pInt] = 0;
							SetPlayerPos(playa, 2524.3831,-1673.9191,14.8585);
							//format(string, sizeof(string), "You are jailed for %d minutes.", money);
							//SendClientMessage(playa, COLOR_RED, string);
							format(string, sizeof(string), "%s has been released by Admin %s",giveplayer,sendername);
							SendClientMessageToAll(COLOR_RED, string);
							PlayerJailLog(string,giveplayer);
						}
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   {BCD4E6}Error: {FFFFFF}Sorry, you cant use this command.");
			}
		}
		return 1;
	}


if(!strcmp(cmd, "/afree", true))
	{
	    if(IsPlayerConnected(playerid))
	    {
	        tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /afree [playerid/PartOfName]");
				return 1;
			}
			new playa
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >=1)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			            if(PlayerInfo[playa][pPrisoned] != 5)
                            return SendClientMessage(playerid, COLOR_GREY, "That player isn`t in Los Santos Prison");
			            GetPlayerName(playa, giveplayer, sizeof(giveplayer));
			            PlayerInfo[playa][pJailCell] = 0;
			            PlayerInfo[playa][pPrisonTime] = 0;
			            PlayerInfo[playa][pPrisoned] = 0;
						SetPlayerSpawn(playa);
			            format(string, sizeof(string), "** You released %s from Los Santos Prison",giveplayer);
			            SendClientMessage(playerid, COLOR_WHITE, string);
			            format(string, sizeof(string), "** You have been released by Admin %s from Los Santos Prison",sendername);
			            SendClientMessage(playa, COLOR_WHITE, string);
			        }
				}
			}
		}
	}

	if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{33CCFF}USAGE:{FFFFFF} /ban [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
			    if(IsPlayerConnected(giveplayerid))
			    {
			        if(giveplayerid != INVALID_PLAYER_ID)
			        {
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
     					GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "{33CCFF}USAGE:{FFFFFF} /ban [playerid/PartOfName] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						new IP[256];
						GetPlayerIp(playerid,IP,sizeof(IP));
						format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d) %s", giveplayer, sendername, (result),month,day,year,IP);
						BanLog(string);
						format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerInfo[giveplayerid][pLocked] = 2;
						Ban(giveplayerid);
						return 1;
					}
				}//not connected
				else
				{
					format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
					SendClientMessage(playerid, COLOR_GRAD1, string);
				}
			}
			else return SendClientMessage(playerid, COLOR_GRAD1, "   {BCD4E6}Error: {FFFFFF}Sorry, you cant use this command.");

		}
		return 1;
	}
if (strcmp(cmd, "/unban", true)==0)
	{
	    if((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >=4)
	    {
	        tmp = strtok(cmdtext, idx);
	        if(!strlen(tmp))
			{
		        SendClientMessage(playerid, COLOR_WHITE, "{33CCFF}USAGE:{FFFFFF} /unban [PlayerName_PlayerLastName]");
	            return 1;
		 	}
			format(string, sizeof(string), "users/%s.ini", tmp);
			new File:hFile = fopen(string, io_read);
			//new File: hFile = fopen(string, io_append);
			if (hFile)
			{
			    new Data[ 256 ],val [ 256 ];
			    while ( fread( hFile , Data , sizeof( Data ) ) )
					if( strcmp( ini_GetKey( Data ) , "Locked" , true ) == 0 )
						val = ini_GetValue( Data );
				if(strval( val ) == 2)
				{
				    new var[64];
					format(var, sizeof(var), "Locked=2\n");
					fdeleteline(string,var);
					fclose(hFile);
					hFile = fopen(string, io_append);
				    format(var, 64, "Locked=0\n");
					fwrite(hFile, var);
					fclose(hFile);
				}
				else
				{
				    fclose(hFile);
					return SendClientMessage(playerid, COLOR_WHITE, "  ERROR : Player account doesn`t locked!!");
				}
			}
            SendClientMessage(playerid, COLOR_WHITE, "Player unlocked please ask for his IP and use /unbanip [IP]");
            format(string, 256, "AdmWarning: %s has unbanned %s", sendername, tmp);
		 	ABroadCast(COLOR_LIGHTRED,string,1);
		 	new year, month,day;
			getdate(year, month, day);
			format(string, 256, "AdmWarning: %s has unbanned %s (%d-%d-%d)", sendername, tmp,day,month,year);
			printf(string);
		}
		return 1;

	}

Problems ...


HTML Code:
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(91) : error 017: undefined symbol "cmd"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(95) : error 017: undefined symbol "tmp"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(95) : error 017: undefined symbol "strtok"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(96) : error 017: undefined symbol "tmp"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(98) : error 017: undefined symbol "COLOR_GRAD2"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(101) : error 017: undefined symbol "giveplayerid"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(101) : error 017: undefined symbol "ReturnUser"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(102) : error 017: undefined symbol "PlayerInfo"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(102) : warning 215: expression has no effect
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(102) : error 001: expected token: ";", but found "]"
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(102) : error 029: invalid expression, assumed zero
C:\Users\mahmoud\Desktop\SAMP Server\pawno\Test Commands.pwn(102) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.

Please anybody help me what do I do to fix these problem.
EthanCortez is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pi ? For pawno Jeffry Help Archive 4 24/01/2011 03:41 PM
Help With Pawno Needed I Changes The Name Becouse it Is Unleading It Was Pawno zzarzzur Help Archive 3 29/01/2010 03:50 AM
PAWNO don't like me GTAScripter Help Archive 5 21/06/2009 08:58 AM


All times are GMT. The time now is 06:25 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.