Help for a first timer!
#1

So this is my first time actually coding anything. I've learnt all I know about PAWN (Not much) off the Wiki, and I tried to script my own command. But there is something wrong, and I have no idea what it is. Could someone tell me how I could fix this?

My code is for a RP server. It's a command for a seatbelt. Basically if someone doesn't do /seatbelt and they crash their car, they lose 10 health, but whenever I compile it I get errors.

Here's the code, could someone tell me what's wrong or what's missing.

Код:
#include <a_samp>

new gSeatBelt[MAX_PLAYERS];

CMD:SeatBelt(playerid, params[]){
 #pragma unused params

        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        new string[128];
        new string1[128];
{
if(IsPlayerInAnyVehicle(playerid)) {

if(gSeatbelt [playerid] == 1) {
format(string, sizeof(string), "* %s reaches over and buckles their seatbelt.", name);
format(string, sizeof(string), "* Click (( %s ))", playername) ;
NearByMessage(playerid, COLOR_PURPLE, string);
NearByMessage(playerid, COLOR_PURPLE, string1);

else{

if(gSeatbelt [playerid] == 0) {
format(string, sizeof(string), "* %s reaches over and unbuckles their seatbelt.", name);
format(string, sizeof(string), "* Click (( %s ))", playername) ;
NearByMessage(playerid, COLOR_PURPLE, string);
NearByMessage(playerid, COLOR_PURPLE, string1);

else{

public OnVehicleDamageStausupdate
new Float:Health;
    new Float:VehHealth;
    GetVehicleHealth(vehicleid, vehHealth);
    SetPlayerHealth(playerid,-10 vehHealth);
return 1;

public NearByMessage(playerid, colour, string[])
	new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
	{
		if(IsPlayerConnectedEx(i) && IsPlayerSpawned(playerid))
	   	{
	   		GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
	   		if(IsPlayerInRangeOfPoint(playerid, 5, PlayerX, PlayerY, PlayerZ))
	   		{
			    if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i) && GetPlayerInterior(playerid) == GetPlayerInterior(i))
	    	    {
	    			SendClientMessage(i, colour, string);
else {
                SendClientMessage(playerid, WHITE, "You are not in a vehicle.");
        }
        return 1;
}
And here are the errors I get.
Код:
C:\Users\Cam\Desktop\Pawn\Seatbelt.pwn(32) : warning 203: symbol is never used: "SeatBelt"
C:\Users\Cam\Desktop\Pawn\Seatbelt.pwn(32 -- 54) : warning 203: symbol is never used: "gSeatBelt"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Thanks!
Reply
#2

public OnVehicleDamageStausupdate

i think this would cause a problem later on
furthermore, you should have the standard publics, try pasting this into a new pawno file(press the new file button, so you get all the publics)
also, include zcmd, #include <zcmd>
good first try though! Keep it going
Reply
#3

I did exactly what you said, paste it into a new file, and #include <zcmd> but this is the error I got.

Код:
C:\Users\Cam\Desktop\Pawn\Test.pwn(235) : fatal error 100: cannot read from file: "zcmd"
Reply
#4

Download it and put it in your Script as : #include <zcmd>
Zcmd Download Link

How to Install it :
*Go to Server Folder
*Open Pawno Folder
*Open Includes Folder in it
*Paste Zcmd Here !

If Helped You, rep Me !
Reply
#5

try
Код:
new SeatBelt
new gSeatBelt
untested tough
Reply
#6

IrCam, make sure you are opening the right pawno. Open the pawno where the include is, and upleft corner press file - open - choose the script from there.
Reply
#7

Hi

Open your Server_Folder/PAWNO/INCLUDES/You must copy here the zcmd.inc.

After it, You must add a line in your Gamemode with the following information:


pawn Код:
#include <zcmd>

Make sure that you have copied the latest version of the mentionated include, otherwise it might now work so well.

I hope it helps!!

Best Regards.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)