my /id command
#1

dcmd_id(playerid,params[])
{
static pname[128], pping, pid[256], ID;
if(sscanf(params, "i", ID)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must use /id [playerid]");
pping = GetPlayerPing(ID);
GetPlayerName(ID, pname, sizeof(pname));
format(pid, sizeof(pid), "Name: %s Ping: %i", pname, pping);
SendClientMessage(playerid, 0xFFFFFFFF, pid);
return 1;
}

theres no errors but i cant /id anyone
Reply
#2

use the "u" sscanf specifier for players, otherwise you will always need to input the player's ID.

pawn Код:
if(sscanf(params, "i", ID)) // noob
if(sscanf(params, "u", ID)) // dope
i also want to recommend to lower the cell size of "pid", no more than 64 for such string is ok.
Reply
#3

ok cool thanks bro,
but this randomly happened out of no where when I tryed to compile

C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(159) : warning 217: loose indentation
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(159) : error 029: invalid expression, assumed zero
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(159) : error 004: function "OnPlayerSpawn" is not implemented
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(164) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(164) : error 029: invalid expression, assumed zero
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(164) : error 004: function "OnPlayerDeath" is not implemented
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(169) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(169) : error 029: invalid expression, assumed zero
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(169) : error 004: function "OnVehicleSpawn" is not implemented
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(174) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(174) : error 029: invalid expression, assumed zero
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(174) : error 004: function "OnVehicleDeath" is not implemented
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(179) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(179) : error 029: invalid expression, assumed zero
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(179) : error 004: function "OnPlayerText" is not implemented
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(193) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(193) : error 017: undefined symbol "dcmd_register"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(195) : warning 219: local variable "file" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(195) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(19 : error 017: undefined symbol "params"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(201) : error 017: undefined symbol "params"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(202) : error 017: undefined symbol "params"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(206) : error 017: undefined symbol "params"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(213) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(213) : error 017: undefined symbol "dcmd_login"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(215) : warning 219: local variable "file" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(216) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(219) : error 017: undefined symbol "params"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(224) : error 017: undefined symbol "params"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(235) : warning 219: local variable "locx" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(235) : warning 219: local variable "locy" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(235) : warning 219: local variable "locz" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(246) : error 017: undefined symbol "params"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(252) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(252) : error 017: undefined symbol "dcmd_pay"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(255) : error 017: undefined symbol "sscanf"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(274) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(274) : error 017: undefined symbol "dcmd_tele"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(27 : warning 219: local variable "locx" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(27 : warning 219: local variable "locy" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(27 : warning 219: local variable "locz" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(279) : error 017: undefined symbol "sscanf"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(289) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(289) : error 017: undefined symbol "dcmd_id"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(291) : warning 219: local variable "pname" shadows a variable at a preceding level
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(292) : error 017: undefined symbol "sscanf"
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(301) : warning 225: unreachable code
C:\Users\Keiren\Desktop\Used\Games\GTA San Andreas\samp\gamemodes\aussieroleplay.pwn(301) : error 029: invalid expression, assumed zero

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.

my script is -

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <dudb>
#include <dutils>

//Colors/////////////////////////////////////////
#define red 0xFF0000AA
//////////////////////////////////////////////////////////////////////
#pragma unused ret_memcpy

new PlayersOnline = 0;
new PlayerName[MAX_PLAYER_NAME];
new Stats[256];
//Registry/////////////////////////////////
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new level[MAX_PLAYERS];
new logged[MAX_PLAYERS];
///////////////////////////////////////////
//package delivery/////////////////////////
new package;
///////////////////////////////////////////
//car pos////////////////////////////////////
new vehicleID = 3;
new playerVeh = 0;
/////////////////////////////////////////////


#if defined FILTERSCRIPT

////////////////////My functions//////////////////////////////////
/* */

/* */
//////////////////////////////////////////////////////////////////////

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Aussie Role Play by Keiren");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Aussie RP");
AddPlayerClass(299,1480.6217,-1748.4281,15.4453,359.6967,0,0,0,0,0,0); // spawnpoint
AddStaticVehicle(481,1645.9115,-1902.1017,13.0687,348.7300,1,1); // bmx1
AddStaticVehicle(481,1641.9512,-1900.8263,13.0170,23.0834,65,9); // bmx2
AddStaticVehicle(481,1638.4685,-1897.7772,13.0199,62.0370,12,9); // bmx3


/////////////////////////////////////
DisableInteriorEnterExits();
/////////////////////////////////////

return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
//Player Check//////////////////////////////////////
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to Aussie Role Play!");
SendClientMessage(playerid, 0xFFFFFFFF, "Dont forget to /register or /login if you already have.");
SendClientMessage(playerid, 0xFF0000FF, "Do not leave the server without logging in or all of your data will be lost.");
PlayersOnline ++;
new PlayersOnlineString[128];
format(PlayersOnlineString, 128, "There are currently %d people in the server.", PlayersOnline);
printf(PlayersOnlineString);
////////////////////////////////////////////////////////
TogglePlayerClock(playerid,0);
//Name Color///////////////////////////////////////////
SetPlayerColor(playerid, 0xFFFFFFFF);
/////////////////////////////////////////////////////////
//skills/////////////////////////////////////////////////
SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,20 0);
SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SI LENCED,200);
SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EA GLE,200);
SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,2 00);
SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_S HOTGUN,200);
SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SH OTGUN,200);
SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI ,200);
SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200);
SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200) ;
SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200);
SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIF LE,200);
//////////////////////////////////////////////////////////////////////////

return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
//registration Money///////////////////////////////////
new file[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
dini_IntSet(file, "money", GetPlayerMoney(playerid));
/////////////////////////////////////////////////////////
//registration logoff///////////////////////////////////
logged[playerid] = 0;
level[playerid] = 0;
///////////////////////////////////////////////////
//Player Check//////////////////////////////////////
PlayersOnline -= 1;
new PlayersOnlineString[128];
format(PlayersOnlineString, 128, "There are currently %d people in the server.", PlayersOnline);
printf(PlayersOnlineString);
/////////////////////////////////////////////////////
//save location//////////////////////////////////////
new Float:locx, Float:locy, Float:locz;
GetPlayerPos(playerid, locx, locy, locz);
dini_FloatSet(file, "X", locx);
dini_FloatSet(file, "Y", locy);
dini_FloatSet(file, "Z", locz);
////////////////////////////////////////
//armour and health//////////////////////////
new Float:health, Float:armour;
GetPlayerHealth(playerid,health);
GetPlayerArmour(playerid,armour);
dini_FloatSet(file, "health", health);
dini_FloatSet(file, "armour", armour);
////////////////////////////////////////////////

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

/////////////////////////Commands//////////////////////////////////
/* */
/* */
///////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////
//chat/////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//Registry/////////////////////////////////////////////////////////
dcmd_register(playerid, params[])
{
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE:/register [password]");
if(dini_Exists(file)) return SendClientMessage(playerid, 0xFF0000FF, "You are already registered!");
dini_Create(file);
dini_IntSet(file, "hashPW", udb_hash(params));
dini_Set(file, "password", params);
dini_IntSet(file, "level", 1);
dini_IntSet(file, "money", GetPlayerMoney(playerid));
new string[128];
format(string, 128, "You succesfully registered the nickname %s with password %s", pname, params);
SendClientMessage(playerid, 0xF6FF00FF, string);
logged[playerid] = 1;
SendClientMessage(playerid, 0xF6FF00FF, "You have been automatically logged in!");
return 1;
}

dcmd_login(playerid, params[])
{
new file[128];
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
if(!strlen(params)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /login [password]");
if(!dini_Exists(file)) return SendClientMessage(playerid, 0xFF0000FF, "You are not registered!");
if(logged[playerid]) return SendClientMessage(playerid, 0xFF0000FF, "You are already logged in!");
new tmp;
tmp = dini_Int(file, "hashPW");
if(udb_hash(params) != tmp)
{
format(string, 256, "You specified the wrong password for %s!", pname);
SendClientMessage(playerid, 0xFF0000FF, string);
}
else
{
logged[playerid] = 1;
level[playerid] = dini_Int(file, "level");
GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
//player pos////////////////////////////////
new Float:locx, Float:locy, Float:locz;
locx = dini_Float(file, "X");
locy = dini_Float(file, "Y");
locz = dini_Float(file, "Z");
SetPlayerPos(playerid, locx, locy, locz);
///////////////////////////////////////////////
//player armour and health////////////////////////////
SetPlayerHealth(playerid, dini_Float(file, "health"));
SetPlayerArmour(playerid, dini_Float(file, "armour"));
///////////////////////////////////////////////////
SendClientMessage(playerid, 0xF6FF00FF, "You have succesfully logged in!");
printf("%s (%i) logged in with password %s", pname, playerid, params);
}
return 1;
}
//////////////////////////////////////////////////////////////////////
// pay command///////////////////////////////////////////////////
dcmd_pay(playerid,params[])
{
static ID, amount, name[MAX_PLAYERS], string7[200], name2[MAX_PLAYERS], string8[200];
if (sscanf(params, "ii", ID,amount)) return SendClientMessage(playerid, 0xff0000aa, "* Usage: /pay [playerid/name] [amount]");
if (amount > GetPlayerMoney(playerid)) return SendClientMessage(playerid, 0xff0000aa, "* You do not have enough money to pay that player!");
if (amount <= 0) return SendClientMessage(playerid, 0xff0000aa, "* You can't pay less than 1!");
if (playerid == ID) return SendClientMessage(playerid, 0xff0000aa, "* You can't pay yourselve!");

GetPlayerName(ID, name2, sizeof(name2));
format(string8,sizeof(string,"{FFFF00}%s has been paid $%i",name2,amount);
SendClientMessageToAll(0xFF0000FF,string;

GetPlayerName(playerid, name, sizeof(name));
format(string7,sizeof(string7),"{FFFF00}%s(%d) has paid you: $%i",name,playerid,amount);
SendClientMessage(ID,0xFF0000FF,string7);

GivePlayerMoney(ID,amount);
GivePlayerMoney(playerid,-amount);
return 1;
}
/////////////////////////////////////////////////////////////////
// admin tele to player//////////////////////////////////////
dcmd_tele(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You do not have permission to use this command");

static ID, Float:locx, Float:locy, Float:locz;
if (sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must use /tele [id]");
else
{
GetPlayerPos(ID, locx, locy, locz);
SetPlayerPos(playerid, locx, locy+3, locz);
return 1;
}
}
//////////////////////////////////////////////////////////////////////////////
// id player////////////////////////////////////////////////////////////////
dcmd_id(playerid,params[])
{
static pname[32], pping, pid[64], ID;
if (sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must use /id [playerid]");
pping = GetPlayerPing(ID);
GetPlayerName(ID, pname, sizeof(pname));
format(pid, sizeof(pid), "Name: %s Ping: %i", pname, pping);
SendClientMessage(playerid, 0xFFFFFFFF, pid);
return 1;
}
///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
public OnPlayerCommandText(playerid, cmdtext[])
{
//registry///////////////////////////////////
dcmd(register, 8, cmdtext);
dcmd(login, 5, cmdtext);
dcmd(pay,3,cmdtext);
dcmd(tele, 4, cmdtext);
dcmd(id, 4, cmdtext);
/////////////////////////////////////////////////
//admin//////////////////////////////////////////

/////////////////////////////////////////////
//LSPD/////////////////////////////////////////
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid,3,1555.0638,-1675.5806,16.1953))
{
SetPlayerInterior(playerid, 10);
SetPlayerPos(playerid, 246.40,110.84,1003.22);
return 1;
}
}

if (strcmp("/exit", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid,3,246.2549,108.44 79,1003.218)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1555.0638,-1675.5806,16.1953);
return 1;
}
}
////////////////////////////////////////////////
//Town Hall////////////////////////////////////
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid,3,1481.6875,-1771.2379,18.795)
{
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid, -2031.1196, -115.8287, 1035.1719);
return 1;
}
}

if (strcmp("/exit", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid,3,-2031.1196, -115.8287, 1035.1719))
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1481.6875,-1771.2379,18.795;
return 1;
}
}
//////////////////////////////////////////////////
//Kill Command/////////////////////////////////

if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, - 1);
}
////////////////////////////////////////////////
//Stats/////////////////////////////////////////
if (strcmp("/stats", cmdtext, true, 10) == 0)
{
new Float:armour, Float:health;
GetPlayerName(playerid,PlayerName, sizeof(PlayerName));
GetPlayerArmour(playerid,armour);
GetPlayerHealth(playerid,health);
format(Stats, 256, "Stats - Name: %s, Armour: %0.f, Health: %0.f,", PlayerName, armour, health);
SendClientMessage(playerid, 0xFFFFFFFF, Stats);
}
////////////////////////////////////////////////
//Rules///////////////////////////////////////
if (strcmp("/rules", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Rule 1. No Meta gaming - mixing OOC things IC things.");
SendClientMessage(playerid, 0xFFFFFFFF, "Rule 2. No Power gaming - doing somthing you cant do in real life i.e. rob someone and then dance.");
SendClientMessage(playerid, 0xFFFFFFFF, "Rule 3. No KOS, Killing on sight");
SendClientMessage(playerid, 0xFFFFFFFF, "Rule 4. No DMing or killing someone without a Role play reason");
SendClientMessage(playerid, 0xFFFFFFFF, "Rule 5. No logging or alt tabbing to avoid death, arrest or anything else.");
}

//Buy Car///////////////////////////////////////
if (strcmp("/buycar Bravura", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 10, 1667.5986,-1887.8107,13.2885))
{
if (GetPlayerMoney(playerid) >= 5000)
{
GivePlayerMoney(playerid, - 5000);
CreateVehicle(401,1667.5986,-1887.8107,13.2885,89.9480,78,76,0);
SendClientMessage(playerid, 0xFFFFFFFF, "Type /getpackage to pickup a package.");
vehicleID ++;
playerVeh = vehicleID;
new VehString[128];
format(VehString, 128, "You are now using vehicle %i", playerVeh);
SendClientMessage(playerid, 0xFFFFFFFF, VehString);
}

else
{
SendClientMessage(playerid, 0xFFFFFFFF, "You do not have enough money to buy this");
}

return 1;
}

}
///////////////////////////////////////////////
//get package///////////////////////////////////////
if (strcmp("/getpackage", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 10, 1667.5986,-1887.8107,13.2885))
{
SendClientMessage(playerid, 0xFFFFFFFF, "You have the package now deliver it to the town hall. ((/dropoff))");
package = 1;
return 1;
}

}
///////////////////////////////////////////////
//deliver package///////////////////////////////////////
if (strcmp("/dropoff", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 10, 1480.6217,-1748.4281,15.4453))
{
if (package == 1)
{
SendClientMessage(playerid, 0xFFFFFFFF, "You have delivered the package.");
GivePlayerMoney(playerid, 2500);
package = 0;
return 1;
}
}

}
///////////////////////////////////////////////
//Buy Car help///////////////////////////////////////
if (strcmp("/buycarhelp", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, "You can /buycar [nameofcar] if at the dealership behind town hall.");
SendClientMessage(playerid, 0x000ED1FF, "Cars - Bravura:$5000");
}
///////////////////////////////////////////////////////
//test vehpos//////////////////////////////////////////////
if(strcmp(cmdtext, "/mycar", true) == 0)
{
new vehpostext[96];
format(vehpostext, sizeof(vehpostext), "The vehicle you are currently using is vehicle %i", playerVeh);
SendClientMessage(playerid, 0xFFFB00FF, vehpostext);
return 1;
}
////////////////////////////////////////////////////
//spawn my car/////////////////////////////////////
if(strcmp(cmdtext, "/spawnmycar", true) == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetVehiclePos(playerVeh, x, y, z);
new VehString[128];
format(VehString, 128, "You have spawned vehicle %i", playerVeh);
SendClientMessage(playerid, 0x26FF00FF, VehString);
}
/////////////////////////////////////////////////////////
//Help///////////////////////////////////////////////////
if(strcmp(cmdtext, "/help", true) == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: HELP");
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Command List - /spawnmycar, /mycar, /buycarhelp, /buycar, /deliverhelp, /buycar [], /rules");
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Command List - /stats, /kill, /enter, /exit, /register, /login");
}
///////////////////////////////////////////////////////
//Deliver Help///////////////////////////////////////////////////
if(strcmp(cmdtext, "/deliverhelp", true) == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Deliver Command List - /getpackage, /dropoff");
}
///////////////////////////////////////////////////////
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

//sscan//////////////////////////////////////////////////////////////////
stock sscanf(string[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(string))
#else
if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = ' ';
while (string[stringPos] && string[stringPos] <= ' ')
{
stringPos++;
}
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if ('0' <= ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return -1;
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
num = 0,
ch = string[stringPos];
do
{
stringPos++;
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{

new changestr[16], changepos = 0, strpos = stringPos;
while(changepos < 16 && string[strpos] && string[strpos] != delim)
{
changestr[changepos++] = string[strpos++];
}
changestr[changepos] = '\0';
setarg(paramPos,0,_:floatstr(changestr));
}
case 'p':
{
delim = format[formatPos++];
continue;
}
case '\'':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != '\'') {}
if (!ch)
{
return -1;
}
format[end] = '\0';
if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = '\'';
stringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case 'u':
{
new
end = stringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = string[++end]) && ch != delim)
{
if (num)
{
if ('0' <= ch <= '9')
{
id = (id * 10) + (ch - '0');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
string[end] = '\0';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - stringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, string[stringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
string[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
stringPos = end;
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
{
stringPos++;
}
while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
{
stringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > ' ')
{
if (delim == '\'')
{
while ((delim = format[formatPos++]) && delim != '\'') {}
}
else if (delim != 'z')
{
return delim;
}
}
}
while (delim > ' ');
return 0;
}
Reply
#4

never mind I just had to copy all my code to another .pwn file
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)