What's wrong with this code
#1

I simply want this code to spawn me to a location, and give me weapons! Simple...


pawn Код:
//DM By Awankz
//Please Dont Remove Credits

#include <a_samp>
#include <streamer>

#include <core>
#include <float>

#define COLOR_RED 0xAA3333AA
#define COLOR_BLUE 0x33CCFFAA
#define COLOR_ERROR 0xFF6A6AFF
#define COLOR_BOMB 0x96BD6AFF
#define COLOR_ORANGE 0xFF6600

public OnPlayerSpawn(playerid)
{
        SetPlayerArmour(playerid, 100);
        SetPlayerHealth(playerid, 100);
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

        if (strcmp(cmdtext, "/sawndm", true) == 0)
        {
                SetPlayerPos(playerid, -1314.0879,2541.4563,87.7422);
               
                SendClientMessageToAll(0xFF6600,".: %s has Joined Sawn off Minigame (Sawndm) :.");
                PlayerPlaySound(playerid ,3200,0,0,0);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                GivePlayerWeapon(playerid, 26, 50000);
                GivePlayerWeapon(playerid, 28, 50000);
               
        return 1;
        }
        return 0;
}

pawn Код:
C:\Users\Administration\Desktop\DM.pwn(37) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
BUT, I get 1 warning, I skipped the warning but as I went In-game and typed /sawndm, the server didn't recognize this command. "Server: Unknown Command". It says that the warning happend at line 217, but there is no line 217... this is all the code
Reply
#2

Mate 217 means the warning code not the line, 37 is the line

This should do it:

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
        if (
strcmp(cmdtext"/sawndm"true) == 0)
        {
                
SetPlayerPos(playerid, -1314.0879,2541.4563,87.7422);
                
SendClientMessageToAll(0xFF6600,".: %s has Joined Sawn off Minigame (Sawndm) :.");
                
PlayerPlaySound(playerid ,3200,0,0,0);
                
SetPlayerHealth(playerid100);
                
SetPlayerArmour(playerid100);
                
GivePlayerWeapon(playerid2650000);
                
GivePlayerWeapon(playerid2850000);
                return 
1;
        }
        return 
0;

You should go on SA-MP Wiki and learn from there.

Here for example: https://sampwiki.blast.hk/wiki/Scripting_Basics

And try out ZCMD it's better and faster, if you wanna make errors like "Wrong parameters. Correct Ones: /givecash [PlayerID]" and even more!

Here is more help:

https://sampwiki.blast.hk/wiki/Category:Tutorials

https://sampwiki.blast.hk/wiki/Category:Scripting_Functions

https://sampwiki.blast.hk/wiki/Script_Examples

https://sampwiki.blast.hk/wiki/Category:Scripting_Callbacks
Reply
#3

Here you go tested.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
               {        
    if (strcmp(cmdtext, "/sawndm", true) == 0)
               {	
    new text[128];
                SetPlayerPos(playerid, -1314.0879,2541.4563,87.7422);
   	        format(text, sizeof(text), ": %s has Joined Sawn off Minigame (Sawndm) :.", Name(playerid));
		SendClientMessageToAll(0xFF6600, text);
		PlayerPlaySound(playerid ,3200,0,0,0);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                GivePlayerWeapon(playerid, 26, 50000);
                GivePlayerWeapon(playerid, 28, 50000);
                return 1;
                }
                return 1;
                }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)