/mypokemons
#1

hi guys i'm making pokemon system
PHP код:
#include "a_samp"
#include <zcmd>
new Squirtle[MAX_PLAYERS];
new 
SquirtleTime[MAX_PLAYERS];
new 
GotATurtle[MAX_PLAYERS];
new 
PokemonTurtle[MAX_PLAYERS];
new 
Cow[MAX_PLAYERS];
new 
CowTime[MAX_PLAYERS];
new 
GotACow[MAX_PLAYERS];
new 
PokemonCow[MAX_PLAYERS];
forward Squirtle_I_Choose_Youuuuu(playerid);
public 
Squirtle_I_Choose_Youuuuu(playerid)
{
        new 
Float:phrr[4];
        new 
playerstate GetPlayerState(playerid);
        if (
playerstate == PLAYER_STATE_DRIVER
        
|| playerstate == PLAYER_STATE_PASSENGER)
        {
        if(
IsPlayerAttachedObjectSlotUsed(playerid,4))
        {
        
SendClientMessage(playerid0xFF0000FF,"Are you crazy?..Turtle can't follow you when you're driving.");
        
SendClientMessage(playerid0xFF0000FF,"Turtle is in your pokč ball!");
        
KillTimer(SquirtleTime[playerid]);
        
DestroyObject(Squirtle[playerid]);
        
GotATurtle[playerid] = 0;
        }
        }
        if (
playerstate == PLAYER_STATE_ONFOOT)
        {
        
GetPlayerPos(playeridphrr[0],phrr[1],phrr[2]);
           
GetPlayerFacingAngle(playeridphrr[3]);
        
SetObjectRot(Squirtle[playerid],0.00.0phrr[3]);
        
MoveObject(Squirtle[playerid], phrr[0]-3,phrr[1],phrr[2],10);
        }
        return 
1;
}
COMMAND:goturtle(playerid,params[])
{
    new 
Float:x1,Float:y1,Float:z1,Float:a;
    if(
IsPlayerAttachedObjectSlotUsed(playerid,4))
    {
    if (
GotATurtle[playerid] == 0)
    {
    
GetPlayerPos(playerid,x1,y1,z1);
    
GetPlayerFacingAngle(playerida);
    
Squirtle[playerid] = CreateObject(1609,x1,y1,z1-1,a,0.0,0.0);
    
SquirtleTime[playerid] = SetTimerEx("Squirtle_I_Choose_Youuuuu",1,true"i"playerid);
    
SendClientMessage(playerid0x00FF00FF,"TURTLE I CHOOSE YOUU , GO!");
       
SendClientMessage(playerid0xFFFF00FF,"Now use /getturtle to get it back to pokč ball!");
    
GotATurtle[playerid] = 1;
    }
    else
    {
    
SendClientMessage(playerid0xFF0000FF,"Are you blind?!?!");
    }
    }
    else
    {
    
SendClientMessage(playerid0xFF0000FF,"You dont have a turtle!");
    }
    return 
1;
}
COMMAND:getturtle(playerid,params[])
{
        if(
IsPlayerAttachedObjectSlotUsed(playerid,4))
        {
        if (
GotATurtle[playerid] == 1)
        {
        
SendClientMessage(playerid0xFFFF00FF,"Come back in pokč ball, turtle!");
        
KillTimer(SquirtleTime[playerid]);
        
DestroyObject(Squirtle[playerid]);
        
GotATurtle[playerid] = 0;
        }
        else
        {
        
SendClientMessage(playerid0xFF0000FF,"First you have to call it from your pokč ball!");
        }
        }
        else
        {
        
SendClientMessage(playerid0xFF0000FF,"You dont have a turtle!");
        }
        return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
        
KillTimer(SquirtleTime[playerid]);
        
GotATurtle[playerid] = 0;
        
KillTimer(CowTime[playerid]);
        
GotACow[playerid] = 0;
        return 
1;
}
COMMAND:buyturtle(playerid,params[])
{
        if (
IsPlayerAttachedObjectSlotUsed(playerid4) == 0)
        {
        
SetPlayerAttachedObject(playerid41609100.00.0,0.00.00.00.00.00.00.0);
        
SendClientMessage(playerid0x00FF00FF,"You have bought a turtle");
        
SendClientMessage(playerid0x00FF00FF,"Now use /goturtle to call it from pokč ball!");
        
GivePlayerMoney(playerid, -20000);
        
GotATurtle[playerid] = 0;
        
PokemonTurtle[playerid] = 1;
        }
        return 
1;
}
COMMAND:sellturtle(playerid,params[])
{
        if(
IsPlayerAttachedObjectSlotUsed(playerid,4))
        {
        
RemovePlayerAttachedObject(playerid,4);
        
DestroyObject(Squirtle[playerid]);
        
SendClientMessage(playerid0x00FF00FF,"You have sold a turtle");
        
GivePlayerMoney(playerid19000);
        
GotATurtle[playerid] = 0;
        
PokemonTurtle[playerid] = 0;
        }
        return 
1;
}
CMD:mypokemons(playerid,params[])
{
    if (
PokemonTurtle[playerid] == 1)
    {
    
ShowPlayerDialog(playerid725,DIALOG_STYLE_LIST,"Pokčmons","Turtle\r\n","OK","Cancel");
    }
    if (
PokemonTurtle[playerid] == 0)
    {
    
SendClientMessage(playerid0xFF0000FF,"You dont have any pokemon");
    }
    if (
PokemonTurtle[playerid] == && PokemonCow[playerid] == 1)
    {
    
ShowPlayerDialog(playerid725,DIALOG_STYLE_LIST,"Pokčmons","Turtle\r\nCow\r\n","OK","Cancel");
    }
    if (
PokemonCow[playerid] == 1)
    {
    
ShowPlayerDialog(playerid725,DIALOG_STYLE_LIST,"Pokčmons","Cow\r\n","OK","Cancel");
    }
    return 
1;
 }
 
forward Cow_I_Choose_Youuuuu(playerid);
public 
Cow_I_Choose_Youuuuu(playerid)
{
        new 
Float:phrr[4];
        new 
playerstate GetPlayerState(playerid);
        if (
playerstate == PLAYER_STATE_DRIVER
        
|| playerstate == PLAYER_STATE_PASSENGER)
        {
        if(
PokemonCow[playerid] == 1)
        {
        
SendClientMessage(playerid0xFF0000FF,"Are you crazy?..Cow can't follow you when you're driving.");
        
SendClientMessage(playerid0xFF0000FF,"Cow is in your pokč ball!");
        
KillTimer(CowTime[playerid]);
        
DestroyObject(Cow[playerid]);
        
GotACow[playerid] = 0;
        }
        }
        if (
playerstate == PLAYER_STATE_ONFOOT)
        {
        
GetPlayerPos(playeridphrr[0],phrr[1],phrr[2]);
           
GetPlayerFacingAngle(playeridphrr[3]);
        
SetObjectRot(Cow[playerid],0.00.0phrr[3]);
        
MoveObject(Cow[playerid], phrr[0]-10,phrr[1],phrr[2],10);
        }
        return 
1;
}
COMMAND:gocow(playerid,params[])
{
    new 
Float:x1,Float:y1,Float:z1,Float:a;
    if(
PokemonCow[playerid] == 1)
    {
    if (
GotACow[playerid] == 0)
    {
    
GetPlayerPos(playerid,x1,y1,z1);
    
GetPlayerFacingAngle(playerida);
    
Cow[playerid] = CreateObject(16442,x1-10,y1,z1-1,a,0.0,0.0);
    
CowTime[playerid] = SetTimerEx("Cow_I_Choose_Youuuuu",1,true"i"playerid);
    
SendClientMessage(playerid0x00FF00FF,"COW I CHOOSE YOUU , GO!");
       
SendClientMessage(playerid0xFFFF00FF,"Now use /getcow to get it back to pokč ball!");
    
GotACow[playerid] = 1;
    }
    else
    {
    
SendClientMessage(playerid0xFF0000FF,"Are you blind?!?!");
    }
    }
    else
    {
    
SendClientMessage(playerid0xFF0000FF,"You dont have a cow!");
    }
    return 
1;
}
COMMAND:getcow(playerid,params[])
{
        if (
PokemonCow[playerid] == 1)
        {
        if (
GotACow[playerid] == 1)
        {
        
SendClientMessage(playerid0xFFFF00FF,"Come back in pokč ball, cow!");
        
KillTimer(CowTime[playerid]);
        
DestroyObject(Cow[playerid]);
        
GotACow[playerid] = 0;
        }
        else
        {
        
SendClientMessage(playerid0xFF0000FF,"First you have to call it from your pokč ball!");
        }
        }
        else
        {
        
SendClientMessage(playerid0xFF0000FF,"You dont have a cow!");
        }
        return 
1;
}
COMMAND:buycow(playerid,params[])
{
        if (
PokemonCow[playerid] == 0)
        {
        
SendClientMessage(playerid0x00FF00FF,"You have bought a cow");
        
SendClientMessage(playerid0x00FF00FF,"Now use /gocow to call it from pokč ball!");
        
GivePlayerMoney(playerid, -20000);
        
GotACow[playerid] = 0;
        
PokemonCow[playerid] = 1;
        }
        return 
1;
}
COMMAND:sellcow(playerid,params[])
{
        if(
PokemonCow[playerid] == 1)
        {
        
DestroyObject(Cow[playerid]);
        
SendClientMessage(playerid0x00FF00FF,"You have sold a cow");
        
GivePlayerMoney(playerid19000);
        
GotACow[playerid] = 0;
        
PokemonCow[playerid] = 0;
        }
        return 
1;

Thats my code..idk how would i make the /mypokemons part...please help me
Reply
#2

What exactly are you trying to do with /mypokemons?
Reply
#3

Show to player which pokиmons he owns
Reply
#4

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)